0

このようなものを作成する必要があります。画像をクリックすると、以下のスクリプトが起動します。

$("#txtHint").html("<form action='inline_spec.php' id = 'upLoadForm' method='post' enctype='multipart/form-data'><center><input type='text' id='file' name = 'file' style='visibility:show' ></center></form>");

スクリプトはテキストファイル入力フォームを開きます。フォームを送信したら、結果をtxtHintで表示する必要があります。出来ますか?

4

1 に答える 1

0

AJAXでフォームを送信しない限りupLoadForm、の結果をに入れることはできません。その方法については、 jQueryフォームプラグイン#textHintを参照してください。jQueryフォームプラグインをページに追加してから、JSの行をこれに置き換えます。

var $hint = $("#txtHint");
var $form = $("<form action='inline_spec.php' id = 'upLoadForm' method='post' enctype='multipart/form-data'></form>")
                .appendTo($hint)
                .html("<center><input type='text' id='file' name = 'file' style='visibility:show' ></center>")
                .ajaxForm(function(response)
                {
                    $hint.html('Response from form post:<br/>' + response)
                });
于 2012-07-26T15:44:46.953 に答える