你的showModelessDialog是哪个窗口打开的?IFRAME1?还是iframe2?还是它们的父窗口?
解决方案 »
- 新手求一段javascript代码
- js获取 li 的值给 iframe src=xxx.html
- 编写网页,如何使得某一链接在点击后出现下载框而不是直接显示出来
- 请问这段代码错在哪里了?
- 请教2个问题
- 如何将预先下载的图片用于改变背景图片?
- 确定鼠标的位置以决定层的显示位置
- 急!求教:Javascript里,如何延迟时间。
- 关于图层在 <select>后面的问题??很着急,请各位帮忙?
- 在focus写return 一直循环 alert一直弹
- 我要实现onresize的功能,但我不希望用onresize这个event,因为这样会运行多次,我希望。。。
- checkbox的checked属性返回的值是什么
<script>
var hDialog = window.showModelessDialog("blank.html","win2","");function doTest() {
hDialog.document.all["panel"].innerText = "This is a pig";
}
</script>
<iframe src="iframe1.html"></iframe>
<iframe src="iframe2.html"></iframe><!-blank.html-->
<html>
<body>
<div id=panel>This is a dog</div>
</body>
</html><!-frame1.html-->
<html>
<script>
function doClick() {
if (typeof(parent.doTest) == "function") {
parent.doTest();
}
}
document.onclick = doClick;
</script>
<body>
</body>
</html>上面这三个文件基本上可以演示你的功能。
var hDialog = null;function doShowDailog() {
hDialog = window.showModelessDialog("blank.html","win2","");
}
=================================
<input type=text value=传递的变量 id=a1>
<input value=传出来 type=button onclick=showModelessDialog('b.htm',window)>
b.htm=================================<input id=b1><input value=传回去 type=button onclick=dialogArguments.a1.value=b1.value><script>b1.value=dialogArguments.a1.value;</script>
你的是显示showModelessDialog里面的内容啊。而且哪个ONCLIKE事件也没有执行,frame1.html该成iframe1.html也不行。说白了,我就是想要IFRAME的 ID 最好还能检测showModelessDialog是否存在,这样ONCLICK事件就不会有冲突了。
for (i = 0;i < parent.frames.length;i ++) {
if (parent.frames[i] == window.self) {
var sFrameName = parent.frames[i].name;//没有办法取得ID,所以先取得name,然后使用name取得id
var sFrameId = parent.document.all[sFrameName].id;
}
}sFrameId就是单击FRAME的id父级HTML文件中的每个IFRAME都要有name和id
什么都找不到!我以前测试时不行,后来改window了