你的showModelessDialog是哪个窗口打开的?IFRAME1?还是iframe2?还是它们的父窗口?

解决方案 »

  1.   

    <!-test.html-->
    <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>上面这三个文件基本上可以演示你的功能。
      

  2.   

    showModelessDialog是一个HTML里的,比如有个按钮可以打开它
      

  3.   

    是不是很笨,test.html是一个简单的测试页面,但然能够改成按钮打开,<INPUT type="button" onclick="javascript: doShowDailog()">在<script></script>之间插入下面的脚本:
    var hDialog = null;function doShowDailog() {
        hDialog = window.showModelessDialog("blank.html","win2","");
    }
      

  4.   

    a.htm
    =================================
    <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>
      

  5.   

    兄弟,不要着急么~!!!苯点也不可以么?
    你的是显示showModelessDialog里面的内容啊。而且哪个ONCLIKE事件也没有执行,frame1.html该成iframe1.html也不行。说白了,我就是想要IFRAME的 ID 最好还能检测showModelessDialog是否存在,这样ONCLICK事件就不会有冲突了。
      

  6.   

    首先,每个IFRAME的SRC的HTML内都要实现一个document.onclick事件,否则没有办法捕获单击的是哪个IFRAME,其中的判断IFRAME的ID可以使用下面的方法:
    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
      

  7.   

    这种对话框,好象找不到父窗口啊!
    什么都找不到!我以前测试时不行,后来改window了