网页传值问题

来源:百度知道 编辑:UC知道 时间:2024/05/30 22:22:06
子窗体,父窗体
子窗体传值给父窗体
值回传问题
大侠们帮忙啊1
波迪大哥,谢谢你,不过我用的是asp.net

用 js,

parent

top

子frame直接用name属性

测试示例:

在同一文件夹下新两个文件:a.htm,b.htm

a.htm的内容如下:

这是父窗口的表单:
<form action="" method="post" name="form" id="form">
<input name="getValue" type="text" id="getValue">
</form>
<iframe src="b.htm" frameborder="1"></iframe>

b.htm的内容如下:

<script>
function postValue(){
parent.document.form.getValue.value=document.form1.theText.value;
}
</script>
这是子窗口的表单:
<form id="form1" name="form1" method="post" action="">
<input type="text" name="theText" />
<input type="button" name="Submit" value="传值" onclick="postValue()">
</form>

运行下a.htm,在文本框中输入文字,点击