先回答第一个问题<html>
<head>
<title>我是阿猫^_^</title>
</head>
<frameset framespacing="0" border="false" cols="180,*" frameborder="0">
<frame name="left" scrolling="yes" marginwidth="0" marginheight="0" src="a.html" />
<frame name="right" scrolling="yes" src="b.html" />
</frameset>
<noframes>
</noframes>
</html>在左边a.html上加个按钮<input type="button" onclick="javascript:top.window.right.location.reload();" />注意:top.window.right里的right是右边frame的name
<head>
<title>我是阿猫^_^</title>
</head>
<frameset framespacing="0" border="false" cols="180,*" frameborder="0">
<frame name="left" scrolling="yes" marginwidth="0" marginheight="0" src="a.html" />
<frame name="right" scrolling="yes" src="b.html" />
</frameset>
<noframes>
</noframes>
</html>在左边a.html上加个按钮<input type="button" onclick="javascript:top.window.right.location.reload();" />注意:top.window.right里的right是右边frame的name
假设有a.htm和b.htm两个页面,a.htm是父页面,b.htm是子页面(或模子)
a.htm里代码如下:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>窗口传值</title>
</head><body>
<input type="text" id="t1" onclick="javascript:window.open('b.htm','','toolbar,resizable,scrollbars=auto,dependent,width=200,height=200');" />
</body></html>b.htm里代码如下:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Js_13.htm传值窗口</title>
</head><body>
<span onclick="window.opener.document.getElementById('t1').value=this.innerHTML;window.close();">123</span>
</body></html>这样就可以把b.htm里的123传入a.htm中的文本输入框了。如果是模态窗口(showModalDialog),就用dialogArguments.document.getElementById('t1').value=this.innerHTML;window.close();你自己试试,不清楚再说。记得结贴哦
window.close()前加上window.returnValue = '值';
window.close()
在父窗口
var a=window.showModalDialog(...);
document.getElementById('文本框').value=a;