var strHTML = "";
strHTML += "<html><body style='background-color:#666'>";
strHTML += "This is a body </body></html>";

解决方案 »

  1.   

    write Method
    --------------------------------------------------------------------------------
    Writes one or more HTML expressions to a document in the specified window. Syntax
        document.write(sText)
        Parameters    sText Required. String that specifies the text and HTML tags to write. Return Value
        No return value.Res
        You should not use the write or writeln methods on the current document 
        after the document has finished loading unless you first call the open method, 
        which clears the current document's window and erases all variables.Note
        When document.write or document.writeln is used in an event handler, 
        document.close should also be used.Standards Information
        This method is defined in World Wide Web Consortium (W3C) 
        Document Object Model (DOM) Level 1 . 
      

  2.   


    Haw-haw, solved by using:
    ifrmDoc.open("text/html","replace");Anyone who comes here will share the points.
      

  3.   

    try :var ifrmDoc = document.getElementsByTagName("iframe")[0].contentDocument;
      

  4.   

    sUrl Required. When opening a new document, sUrl is a String that specifies a Multipurpose Internet Mail Extensions (MIME) type for the document. When opening a new window, sUrl is a String that specifies the URL to render in the new window. If a sUrl is not specified, a new window with about:blank is displayed.text/html Default. Currently the only MIME type supported for this method. 
     
    don't use open("about:blank") parameter.you can use default Value, default is text/html;ifrmDoc.open();
    ifrmDoc.write("never-online");
    ifrmDoc.close();
      

  5.   

    In Firefox 1.5.0.2ifrmDoc.open() works differently from ifrmDoc.open("text/html")you should use ifrmDoc.open("text/html") if you want to write HTML to the Doc.