11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Z-Lock: <br />

<br />

<br />

<br />

<br />

<br />

<strong>JavaScript</strong> Window.open Statement<br />

<br />

<br />

<br />

<br />

Writing to Windows<br />

Up to now, all the examples with windows have used an existing document—either a remote<br />

URL like http://www.yahoo.com or a local file like example.htm—to load into a created<br />

window. We can actually write to windows once they are created either using the standard<br />

document.write() method or potentially even manipulate the window with DOM methods.<br />

Consider the script here,<br />

var myWindow = open('','mywin','height=300,width=300');<br />

myWindow.document.write('Hi there. ');<br />

myWindow.document.write('This is my new window');<br />

myWindow.document.close();<br />

myWindow.focus();<br />

which creates a simple window with a sentence of text in it as shown in Figure 12-1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!