A,B两个页面,A里面用iframe包含B,现在在A里面要取得B里面一个Hidden控件的value
a.html
b.html
- HTML code
-
<html> <head> </head> <script language="javascript"> function test(){ alert(document.getElementById("f1").contentWindow.document.getElementById("text1").value); } </script> <body> <h1>a.html</h1> <input type="button" value="test" onclick="test()"> <br> <iframe id="f1" src="b.html"></iframe> </body> </html>
b.html
- HTML code
-
<html> <head> </head> <body> <h1>b.html</h1> <input type="hidden" id="text1" value="abcdefg"/> </body> </html>