为了与java脚本中的警报和提示对话框保持一致我想知道是否有一个对话框接受2个输入而不是一个?
我尝试了几种方法,例如:
创建表单
<form id="management_form">
Enter Option: <input type="text" id="optiontb" name="option">
<input type="button" onclick="myfunction(this.form)" value="submit"> </form>
并调用
document.management_form.submit(); in the java script method
这会在 html 文件中的表单代码所在的位置显示表单。而不是在调用表单时
并创建
使用的表单
var newdiv = document.createElement();
newdiv.innerHTML = "Entry <br><input type='text' name='myInputs[]'>";
document.appendChild('newdiv');
为此,我看到错误 Uncaught error:NOT_FOUND_ERROR:DOM Exception8
有更好的方法吗?
编辑: 按照 Girish 的建议执行一些操作后:
html代码如下:
<title>
<style>
I have include the code for the style
</style>
<script>
function request()// renamed it here
{ // this is exactly same the code in the sample web site
}
我如何调用这个java脚本方法
function myfunction(frm)
{
var opt=frm.option.value;
request();
$( "#dialog-form" ).dialog( "open" );
} 这是从
调用的 <form name="management_form">
Enter Option: <input type="text" id="optiontb" name="option">
<input type="button" onclick="myfunction(this.form)" value="submit"> </form>
可以在此处添加任何内容,以便将其显示为对话框而不是像 html 页面一样吗?
最佳答案
我认为您想要这种类型的功能,因此您可以检查此 URL
http://jqueryui.com/demos/dialog/modal-form.html
如果您喜欢这个,请下载它的代码并将其实现到您的代码中......
关于javascript - 具有 2 个输入的 JavaScript 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10794892/