效果图:
index.htm代码:
<script>
function func()
{
document.all.t_1.value=window.showModalDialog("test.htm","","dialogWidth=300px;dialogHeight=250px;help=no;center=yes;");
}
</script>
<input type="text" id="t_1" name="t_1" /><input type="button" value="test" on
test.htm代码:
<title>Hello Js</title>
<script>
function func()
{
window.returnValue="Hello Js!";
window.close();
}
</script>
hello!this is test.htm.
<input type="button" value="test" on
注意:
想在showModalDialog打开的窗口中提交表单且不打开新窗口
只需在打开的页面的<head>中加入<base target="_self">
在<form>中不写target属性或target属性为空
评论