<iframe id="frame" name="frame" style="z-index: 1; border: 0; width: 100%; height: 100%">                        
    <object id="ReportViewer" codebase="http://www.mysite.com/webreport/griectl.cab#Version=5,0,0,0"
        height="100%" width="100%" classid="CLSID:E060AFE6-5EFF-4830-B7F0-093ECC08EF37">
        <param name="ReportURL" value="Model\Client.grf" />
        <param name="DataURL" value="Test.aspx?function_id=106000" />
        <param name="AutoRun" value="true" />
    </object>
</iframe>
js代码中怎么取到这个object?求解答。

解决方案 »

  1.   

    这个是被iframe引用的页面里的对象还是就如你所写,被iframe包含着?
      

  2.   

    iframe中间可以加元素,这个是什么效果?
      

  3.   

    就是被iframe包着的。之所以这么写,是因为页面上有些弹出div,需要显示在object对象上面
    像设置z-index这些办法都没用,把object放到单独页面再被iframe引用也不行的,所以才会有这个问题
      

  4.   

    用你的代码我在firebug下看了下,根本没有这个object元素了
    换种方法吧
      

  5.   


    额,那还有什么办法可以让div显示在object对象上面呢?
      

  6.   

    好像都是iframe引用一个页面吧,把object放到页面里吧。
      

  7.   

    这种?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var objID = $($('#frame').html().replace(/&lt;/ig, '<').replace(/&gt;/ig, '>')).attr('id');
                alert(objID); //显示ReportViewer
            });
        </script></head>
    <body>
    <iframe id="frame" name="frame" style="z-index: 1; border: 0; width: 100%; height: 100%">                        
           <object id="ReportViewer" codebase="http://www.mysite.com/webreport/griectl.cab#Version=5,0,0,0"
               height="100%" width="100%" classid="CLSID:E060AFE6-5EFF-4830-B7F0-093ECC08EF37">
               <param name="ReportURL" value="Model\Client.grf" />
               <param name="DataURL" value="Test.aspx?function_id=106000" />
               <param name="AutoRun" value="true" />
           </object>
    </iframe>
    </body>
    </html>
      

  8.   


    这个只是又动态生成了一个object,不是原来iframe里面那个
      

  9.   


     var obj =  document.getElementById('frame').contentWindow.document.getElementById("ReportViewer");
    alert(obj);try 一下
      

  10.   

    谢谢,不过还是不行。我暂时不弹出div了,直接showModalDialog,算是把这个问题绕过去了,不过还是希望能找到弹出div的解决办法。