++关于抓取iframe里面控件值的问题?++ document.getElementById("ifrmae").getElementById("id");必须要在里面的页面加载完了才行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如B所在的iframe name="ifr_b", B的 hidden 控件 id为 hidA里面这样 frames.ifr_b.document.getElementById('hid').value如果 hid在form name="form_b"里 hidden控件 name="hid"可以不用写ID这样 frames.ifr_b.document.form_b.hid.value前提都是在调用上面方法前 B页面是已经 onload的 a.html<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> <head> </head> <body> <h1>b.html</h1> <input type="hidden" id="text1" value="abcdefg"/> </body></html> $("#iframe id").contents().find("#iframe 中的 ID").val(); $("#iframe id").contents().find("#iframe 中的 ID").text(); $("#iframe id").contents().find("#iframe 中的 ID").html(); 关于js代码写的整洁的问题 [散分]开春第一帖 给大伙拜年 email和分号 正则 请教javascript如何关闭本地的应用程序 谁能帮修改兼容所有浏览器 一个关于闭包的问题 如何在vbscript里给js中的变量赋值 怎么去的数组的最后一个值 本人想写一个树形目录,不知如何下手,望高手指点一下 请帮我看看这段js脚本是什么意思??? javascript 新人提问,奇怪的语法 在一个div里设置属性style="display:none" 为什么js就获取不到文本框里的值
frames.ifr_b.document.getElementById('hid').value
如果 hid在form name="form_b"里 hidden控件 name="hid"
可以不用写ID
这样 frames.ifr_b.document.form_b.hid.value前提都是在调用上面方法前 B页面是已经 onload的
<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>
<head>
</head>
<body>
<h1>b.html</h1>
<input type="hidden" id="text1" value="abcdefg"/>
</body>
</html>
$("#iframe id").contents().find("#iframe 中的 ID").text();
$("#iframe id").contents().find("#iframe 中的 ID").html();