如何使用JS 向Iframe的文本框中写入一个字符 如何使用JS 向Iframe的文本框中写入一个字符如写入ABC,能不能给一个简单的例子,谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 a.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>a</title></head><body><iframe src=b.htm onload="this.contentWindow.document.getElementById('txt1').value='从父页面写过来的'"></iframe></body></html>b.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>b</title></head><body><input type=text id="txt1"></body></html> 非常感谢两位,不好意思,我没写清楚,我的Iframe是别人的网站,怎么写入呢 lz可以自己搜搜“js 跨域”这里有篇文章:http://zhuhaifeng.javaeye.com/blog/437154 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>a</title><script>window.onload = function () { window.frames["main"].document.getElementById("txt1").value = "bac";};window.frames["main"].onload = function () { window.frames["main"].document.getElementById("txt1").value = "bac";};</script></head><body><iframe name='main' src=b.htm ></iframe></body></html>b.html<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>b</title></head><body><input type=text id="txt1"></body></html> 我靠,,邪门了,,document.getElemnetById没用。。 |zyciis| 当form post 后如何再执行一个方法,谢谢 JavaScript&面向对象 请教JS开发的老手 如何动态控制marquee标记的滚动速度? typeof()的功能???? jsp上传图片如何通过js获得图片的全名(包括扩展名)? 框架打印问题,请高手们指点指点~!! netBook补丁 大家来帮我呀!有高分向赠! 关于正则的一段小代码请教 很简单的小问题 谁看得懂这段javascript代码
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>a</title>
</head><body>
<iframe src=b.htm onload="this.contentWindow.document.getElementById('txt1').value='从父页面写过来的'"></iframe>
</body></html>
b.htm<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>b</title>
</head><body>
<input type=text id="txt1">
</body></html>
不好意思,我没写清楚,我的Iframe是别人的网站,怎么写入呢
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>a</title>
<script>
window.onload = function () {
window.frames["main"].document.getElementById("txt1").value = "bac";
};window.frames["main"].onload = function () {
window.frames["main"].document.getElementById("txt1").value = "bac";
};
</script>
</head><body>
<iframe name='main' src=b.htm ></iframe>
</body></html>
b.html<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>b</title>
</head><body>
<input type=text id="txt1">
</body></html>