关于子框架iframe往父框架中传值

来源:互联网 发布:数据透视图教程 编辑:程序博客网 时间:2024/06/05 02:40
父框架代码:
<html>
<head>
<title>index.htm</title>
</head>
<body>
<input type=text name="psy">
<iframe src="1.htm"></iframe>
</body>
</html>
 
子框架代码( 1.htm):
 
<html>
<head>
<form  action="admin.asp"  method="post">
<input name="ad"  type="checkbox"  value="1" id="xxx" onClick="parent.document.getElementByIdx('psy').value=forms[0].ad.value;">
<input  type="submit"  value="提交">
<input  type="reset"  value="全部重写">
</form>
</body>
</html>
 
下面这点是本人自己加的了,可以把1.htm中的
onClick="parent.document.getElementByIdx('psy').value=forms[0].ad.value;"
换成
onClick="parent.document.getElementByIdx('psy').value=forms[0].ad.id;"
这样就方便一点了,换了有什么好处自己想去!嘿嘿.......v
0 0
原创粉丝点击