window.id.document.open() 改成  document.getElementById('ID').docuemnt.open();

解决方案 »

  1.   

    刚才实验了一下document.getElementById("imb_Background").document has no properties
    [Break on this error] document.getElementById("imb_Background").document.open();
    提示以上的显示。
      

  2.   

    if (document.getElementById("imb_Background")==null){
                    document.body.innerHTML += "<iframe id=\"imb_Background\" src=\"about:blank\" style=\"position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;\" frameborder=\"0\"></iframe>";
                    window.imb_Background.document.open();
                    window.imb_Background.document.write("<html><body bgcolor=red>&nbsp;sdfasdfasdf</body></html>");
                    window.imb_Background.document.close();
                }
                if (document.getElementById("imb_FormModal")==null){
                    document.body.innerHTML += "<iframe id=\"imb_FormModal\" src=\"about:blank\" style=\"position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;border-bottom:2px solid #999999;border-right:2px solid #999999;border-top:1px solid #F8F6C1;border-left:1px solid #F8F6C1;\" frameborder=\"0\"></iframe>";
                    window.imb_FormModal.document.open();
                    window.imb_FormModal.document.write("<html><head><style><!--");
                    window.imb_FormModal.document.write("td{font-size:12px;");
                    window.imb_FormModal.document.write("//--></style></head><body scroll=no leftmargin=0 topmargin=0>");
                    window.imb_FormModal.document.write("<table width=100% height=100% bgcolor=\"#eeeeee\"><tr><td  align=left bgcolor=red><div id=\"imb_Title\" style=\"padding-left:3px;padding-right:3px;color:white;font-family:verdana;\">");
                    window.imb_FormModal.document.write("</div></td></tr><tr><td align=left><div id=\"imb_Content\" style=\"padding:7px;\">");
                    window.imb_FormModal.document.write("</div></td></tr><tr><td id=\"imb_Body\" align=center>");
                    window.imb_FormModal.document.write("</td></tr></table>");
                    window.imb_FormModal.document.write("</body></html>");
                    window.imb_FormModal.document.close();
                }
      

  3.   


    <body>
    <iframe id="imb_Background" src="about:blank"></iframe>
    </body>
    <script type="text/javascript">
    var doc = document.getElementById("imb_Background").contentWindow.document;
    doc.open();
    doc.writeln('<h1>hello,world!</h1>');
    doc.close();
    </script>