15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

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.

Document<br />

Chapter 2 ✦ Window and Frame Objects (Chapter 16)<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓<br />

Example<br />

While you have far easier ways to reach the document object of another frame<br />

(parent.otherFrameName.document), the following statement takes the long way<br />

to get there to retrieve the number of forms in the document of another frame:<br />

var formCount = parent.document.all.contentsFrame.Document.forms.length<br />

Using the Document property only truly makes sense when a function is passed a<br />

FRAME or IFRAME element object reference as a parameter, and the script must,<br />

among other things more related to those objects, access the document contained<br />

by those elements.<br />

frameBorder<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

The default value for the frameBorder property is yes. You can use this setting<br />

to create a toggle script (which, unfortunately, does not change the appearance in<br />

IE). The W3C-compatible version looks like the following:<br />

function toggleFrameScroll(frameID) {<br />

var theFrame = document.getElementById(frameID)<br />

if (theFrame.frameBorder == “yes”) {<br />

theFrame.frameBorder = “no”<br />

} else {<br />

theFrame.frameBorder = “yes”<br />

}<br />

}<br />

height<br />

width<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓<br />

191<br />

FRAME.height

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

Saved successfully!

Ooh no, something went wrong!