内にいくつかのコンテンツfunctionを表示するための を定義しました:htmljqueryui 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初めて" " を呼び出し、inputavalueのみを呼び出して [ textboxOK] を押すと、 の値でアラートが表示されますtextbox。そして、再度 を呼び出して、にfunction何も入力せずに [OK] を押す と、古い. 私のコードの問題は何ですか?textboxalertvalue
編集:見たい場合の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>