例如:在当前窗口A下点击一链接,用showModalDialog方法打开一个输入查询内容的对话框B,输入查询内容后,将查询的内容显示在当前页面A下,而不打开新的窗口。 各位老大帮忙,大家一起来讨论一下啊
//A.htm
<html> <head> <script language="JavaScript"> function ok() { //window.open("B.htm"); form1.textfield.value=window.showModalDialog("B.htm"); //window.showModelessDialog("B.htm"); }
</script> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body>
<form name="form1" method="post" action="B.htm"> <input type="text" name="textfield"> <input type="button"name="Submit" value="1--------->2" onClick="ok()"> </form>
</body> </html>
//B.htm
<html> <head> <script language="JavaScript"> function pop() { window.returnValue=form2.textfield2.value; window.close(); } </script> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body>
<form name="form2" > <input type="text" name="textfield2"> <input type="button" name="btn" value="button" onclick="pop()"> </form>
</body> </html>
不知上面的是否是你想要的?