内にいくつかのコンテンツfunction
を表示するための を定義しました:html
jqueryui dilaog
function ui_window(title, dialogWidth, content,buttons,className)
{
$('<div id="window">').html(content).
dialog({
title: title,
show: 'drop',
hide: 'drop',
width: dialogWidth,
buttons: buttons,
close: function (ev, ui) { $(this).remove(); },
position: { my: 'center', at: 'center', of: window }
}
).addClass(className);
return false;
}
function
そして、上記を呼び出す別の JavaScriptを次に示しfunction
ます。
function checkForValidCommand()
{
var content = getInnerHTML("#checkForValidCommand");
var myFunc = function ()
{
var pensionerID = $('#txtID').val();
alert(pensionerID);
$(this).dialog('destroy');
}
else
$('#txtID').focus();
}
var buttons = [{ text: 'OK', click: myFunc}];
ui_window("Pensioner", 410, content, buttons);
}
checkForValidCommand
初めて" " を呼び出し、input
avalue
のみを呼び出して [ textbox
OK] を押すと、 の値でアラートが表示されますtextbox
。そして、再度 を呼び出して、にfunction
何も入力せずに [OK] を押す と、古い. 私のコードの問題は何ですか?textbox
alert
value
編集:見たい場合のhtmlコンテンツは次のとおりです。
<table>
<tr>
<td align="right">
<label>
Insert the pensioiner's ID:
</label>
</td>
<td>
<input id="txtID" type="text" onkeydown="return onlyNumbers(event);" maxlength="8"/>
</td>
</tr>
</table>