index.html:
<html>
<body>
<div>
<iframe id="a" stc=a.html>
</iframe>
</div>
</body>
</html>
a.html:
<html>
<frameset>
<frame src="aa.html" id="aa">
<frame src="bb.html" id="bb">
</frameset>
</html>aa.html:
<html>
<body>
<div>
<input id="aaa" name="aaa" value="" type="text">
</div>
</body>
</html>
通过document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value 可以获取aa.html页面上的值传到到index.html上。
现在的要求是从index.html 的JS里定义一个常量,赋值给aa.html的value值。
<html>
<body>
<div>
<iframe id="a" stc=a.html>
</iframe>
</div>
</body>
</html>
a.html:
<html>
<frameset>
<frame src="aa.html" id="aa">
<frame src="bb.html" id="bb">
</frameset>
</html>aa.html:
<html>
<body>
<div>
<input id="aaa" name="aaa" value="" type="text">
</div>
</body>
</html>
通过document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value 可以获取aa.html页面上的值传到到index.html上。
现在的要求是从index.html 的JS里定义一个常量,赋值给aa.html的value值。
解决方案 »
- ajaxFileUpload 上传图片 跨子域上传可返回值得不到
- 如何在子页面里获取所在父页面的IFrame对象
- |zyciis| 200分 求一个JS二级菜单 第二贴 xiaojing7 给的菜单有问题不像我要的那个
- 页面加载如何修改传递给控件的参数?
- 复选框在本页传值问题,急急,在线等!
- 求在aspx页下一段javascript的浮动广告(随滚动条一起上下移动)代码,试了有效马上给分,谢谢
- 我现在在改梅老大的MzTreeView10,有许多问题,谢谢回答
- 急需chinaren相册图片滚动和幻灯片播放的效果的代码
- 怎么样把鼠标变成手形,在不加<a href="#">的情况下
- js数字怎么转化为正整数 比如150 转为100 190转为100 1462转为1400 数字的后两位直接转成00
- 请教:当前页面如何执行另一个页面
- 求教关于字符串匹配的问题
window.opener.document.getgetElementById("a").value = '';的方式来赋值
如果是弹出的第n个页面的话,那么可以写n个 opener
document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value
可以取到aa.html的value值。那么只要
document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value = "bbb";就可以实现赋值了。下面是我做的测试代码,
function test() {
var obj = document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa");
obj.value = "bbb";
}
实现了在index.html中调用这个方法就可以将aa.html中的aaa文本框的值赋为“bbb”。
document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value ="";不行??
document.getElementById("a").contentWindow.document.getElementById("aa").contentWindow.document.getElementById("aaa").value 这个过程是从aa.html到index.html的 就是一个来一个回得问题。我现在只知道怎么把值从aa.html中要过来,但是不知道怎么把值给它
你在获取下,看看是不是想吻合....
难道不行???