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.

contentDocument<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 />

A document script might be using the ID of an IFRAME element to read or adjust<br />

one of the element properties; it then needs to perform some action on the content<br />

of the page through its document object. You can get the reference to the document<br />

object via a statement, such as the following:<br />

var doc = document.getElementById(“FRAME3”).contentDocument<br />

Then your script can, for example, dive into a form in the document:<br />

var val = doc.mainForm.entry.value<br />

frameBorder<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

See the example for the FRAME.frameBorder property earlier in this chapter.<br />

hspace<br />

vspace<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

The following fragment sets the white space surrounding an IFRAME element to<br />

an equal amount:<br />

document.all.myIframe.hspace = 20<br />

document.all.myIframe.vspace = 20<br />

Unfortunately these changes do not work for IE5/Windows.<br />

199<br />

IFRAME.hspace

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

Saved successfully!

Ooh no, something went wrong!