<!-- RpDZT RpParse=0 -->
var myPopupWindow;
var myWindowsDoc;
var anInteger = 0

function makeMeAWindow()
{
    myPopupWindow = window.open("new_window.html", "thePopupWindow", "height=500, width=500, left=100, top=100, resizable=yes, scrollbars=yes,toolbar=yes,menubar=no,location=no, status=yes");
    myWindowsDoc = myPopupWindow.document;
    myWindowsDoc.open();
    myWindowsDoc.writeln("<html><head><title>");
    myWindowsDoc.writeln("My Document Title");
    myWindowsDoc.writeln("</title>");
    myWindowsDoc.writeln("</head>");
    myWindowsDoc.writeln("<body>");
    myWindowsDoc.writeln("Hello from javascript");
    myWindowsDoc.writeln("<p>");
    myWindowsDoc.writeln("This page was created on the fly");
    myWindowsDoc.writeln("by having a javascript function");
    myWindowsDoc.writeln("write HTML to a newly created window");
    myWindowsDoc.writeln("<p>");
    myWindowsDoc.writeln("An onClick associated with an href and an ");
    myWindowsDoc.writeln("anchor tag initiated the function call");
    myWindowsDoc.writeln("</body>");
    myWindowsDoc.writeln("</html>");
	theNameElement=document.getElementsByName("theNameField");
	anInteger = anInteger + 1;
	if(theNameElement != null)
	{
	   theNameElement[0].value="javascript filled in this field  " + anInteger +" times"; 
	}
    myWindowsDoc.close();
    //myPopupWindow.close();
}
<!-- RpEnd -->
