MDN wants to learn about developers like you:


When I tried to use the following script from the pages of I got an error message from the JavaScript console in Mozilla Firefox saying that msgWindow was not defined.

The following example opens the msgWindow window and creates an anchor for the table of contents:

var myString="Table of Contents"

The previous example produces the same output as the following HTML:

<A NAME="contents_anchor">Table of Contents</A>

However when I changed the script to the following, I found that the script worked:

<script language = "JavaScript">

var myString="Table of Contents"

//The above script produces the same results as the html in the anchor tags
//<A NAME="contents_anchor">Table of Contents</A>            

--Meandmymachine 21:12, 13 November 2005

msgWindow should be a var holding a reference to a popup window. I don't know why the example doesn't just use document.writeln. All examples in this reference that use the DOM should minimize usage of the DOM to only basic things like alert, document.write, document.writeln, and innerHTML. I'll change it.
BTW, it is heavily discouraged to use this and other HTML-related methods for various reasons. --Maian 18:53, 13 November 2005 (PST)

Document Tags and Contributors

 Contributors to this page: Maian, Meandmymachine
 Last updated by: Maian,