ボタンを押したときに、PHP の関数を呼び出したいとします。
Form を使って PHP ファイルを読み込み、ページ全体を書き直すという手段もありますが、ある関数だけを呼び出したいときなど、ajax を使うと PHP 関数を呼び出してページ側で返り値を得ることができます。
このように、url でファイル名を指定して、success で返り値 results として引き渡してやります。
PHP ファイル側では、渡したい値を echo などで表示します。
これで PHP の関数をページから呼び出すことができます。
火曜日, 5月 13, 2014
木曜日, 5月 01, 2014
HTMLエディターを1行で書く
HTMLエディターを1行で書いてみました。
要するに、書いたHTMLがそれっぽく見えればWYSIWYGってわけですよね。
じゃあ、書いたものをそのままブラウザ表示すりゃいいわけじゃないですか。
これを動かすと、何もないテキストボックスが下のほうに表示されます。
適宜 HTMLコードを入力してみましょう。
画面上部に結果が表示されます。
リアルタイムでHTMLコードが編集できます。
ちょっとしたプレビューにも使えます。
要するに、書いたHTMLがそれっぽく見えればWYSIWYGってわけですよね。
じゃあ、書いたものをそのままブラウザ表示すりゃいいわけじゃないですか。
これを動かすと、何もないテキストボックスが下のほうに表示されます。
適宜 HTMLコードを入力してみましょう。
画面上部に結果が表示されます。
リアルタイムでHTMLコードが編集できます。
ちょっとしたプレビューにも使えます。
金曜日, 2月 10, 2012
Newline in select-option tags
Our site had a list of fonts available for our clients. The list included, European and Cyrillic fonts. We put them in a drop-down list.
Then, it turned out to be that Cyrillic fonts were included in European fonts. We had to select/deselect both at the same time. The trouble is, the HTML's
Here is a word of caution; we had yet another problem with the Cyrillic option with the reset operation. The Cyrillic option has to be deselected manually.
List of fonts:
European
Cyrillic
Then, it turned out to be that Cyrillic fonts were included in European fonts. We had to select/deselect both at the same time. The trouble is, the HTML's
select's option does not take br tags, or new lines. All lines have to be in a single line.
Here is a jQuery code that select/deselect European and Cyrillic fonts at the same time. The code hooks any click on the European fonts to a handler that select/deselect Cyrillic fonts.
$('#European').live("click",function(){
var selected=$('#European').attr("selected");
if(selected=="selected")
{
$('#Cyrillic').attr("selected","selected");
}
else
{
$('#Cyrillic').attr("selected",false);
}
});
Here is a word of caution; we had yet another problem with the Cyrillic option with the reset operation. The Cyrillic option has to be deselected manually.
// de-selects the Cyrillic option.
$("#reset").click(function(){
$('#Cyrillic').attr("selected",false);
});
登録:
投稿 (Atom)
Flask の Blueprint のテンプレート問題
Flask の Blueprint は、ルート、静的ファイル、テンプレートをまとめて管理できます。しかし、テンプレートが指定できません。 ここでは、Blueprint の template_folder の問題点と回避策を説明します。 Blueprint のテンプレート問題...
-
コンデンサマイク 極性があります コンデンサマイクがようやく届きました。モジュールではないのでそのままでは信号が弱いので使えません。信号を増幅する必要があります。 ちょっとした手間ですが、首尾よく動いてくれました。この回路の応用で、使えるマイクが出来ます。 ...
-
Qt はまってます。Mac でも書いたアプリがコンパイルできて、しっかり動くのを確認しました。このあいだ Chitubox が Qt 使ってるのを知ってうれしかったです。 Mac でもそのまま動くんですが、アプリのアイコンの設定はプラットフォーム依存です。 公式マニュアルでも設定...
-
今日ホール素子が届きました。 ホール素子ってのは ホール効果 を利用して磁場を感知するセンサーです。 iPad のケースとか、閉じると電源が切れてくれますよね。ケースのカバーの磁石の磁場をホール素子が感知してるわけです。 さっそくホール素子を使ってみよう!電圧...