I read somewhere that HTML5 will not allow document.write() statements.
The following script does use the document.write() statement and it seems to work to create a new window
BUT, I get and error in the error console stating
-----------------------------
Timestamp: 12/9/2012 11:34:22 PM
Warning: XUL box for _moz_generated_content_after element contained an inline #text child, forcing all its children to be wrapped in a block.
Source File: chrome://browser/content/browser.xul
Line: 0
-----------------------------
What is the appropriate statement to replace the document.write() to avoid the error reports?
Code:<!doctype html5> <html> <head> <title>JS created window</title> <script type="text/javascript"> function newHTML() { var HTMLstring='<HTML>\n'; HTMLstring+='<HEAD>\n'; HTMLstring+='<TITLE>New Document</TITLE>\n'; HTMLstring+='</HEAD>\n'; HTMLstring+='<BODY>\n'; HTMLstring+='<P>Hello</P>\n'; HTMLstring+='</BODY>\n'; HTMLstring+='</HTML>'; var newwindow=window.open("", "Window3", "width=320,height=210,scrollbars=yes"); newwindow.document.write(HTMLstring); // What is replacement statement for document.write() ??? newwindow.document.close(); } </script> </head> <body> <input type="button" value="New Window" onclick="newHTML();"> </body> </html>


Reply With Quote
Bookmarks