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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

}<br />

//-->><br />

else<br />

<br />

<br />

<br />

customAlert("Bored Guru", "Don't waste my time.");<br />

<br />

<strong>JavaScript</strong> Guru 1.1<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<strong>The</strong> last example would only be useful to write content to a document as it loaded. However,<br />

we can easily use proprietary Document objects like document.all or the more standard DOM<br />

methods to modify windows after load time, as briefly demonstrated in the next section.<br />

DOM Methods and Windows<br />

Using DOM statements, we could of course insert and change the HTML in the new document<br />

at will. <strong>The</strong> main difference is that you must make sure to use the new window‘s name when<br />

accessing a DOM method or property. For example, if you had a window called newWindow,<br />

you would use statements like<br />

var currentElement = newWindow.document.getElementById("myheading");

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

Saved successfully!

Ooh no, something went wrong!