JS弹出网页问题

来源:百度知道 编辑:UC知道 时间:2024/06/21 07:33:15
写一段JS代码,要求:在网页a中点击按钮,弹出网页b,在网页b中的name=txt的输入框中输入数据,点击按钮后关闭网页b,在网页a中显示网页b中txt的值!

请各位高手帮忙了,最后再加点注释,在线等!
因为我在网页b中还有东西,不是单纯的输入,如果有简单的办法我干嘛不用,对不?

这样已经是最好的办法了,知道怎么写的就发出来,只要一段js代码就行

可以,用ASP也可以,只要能写出来 就行

根据你描述的需求,你应该使用HTML中的模式窗口,showModalDialog()来解决.
A.html:
<input name="" type="button" onclick="openB()" value="打开B.html" />
<script>
function openB(){
digStr="dialogHeight:400px;dialogWidth:500px;center:yes"
var ReturnValue = window.showModalDialog("b.html","",digStr)
alert("你在B.html中的文本框中输入了:"+ReturnValue);
}
</script>

B.html:
<input name="text1" type="text" /><br />
<input name="" type="button" onclick="onunload()" value="返回A.html"/>
<script>
function window.onunload() {
window.returnValue = text1.value
window.close();
}
</script>

window.open 方法打开b页面
b页面的提交时用 js读取name=txt的内容
<script language="javascript">
function submitform()
{
window