15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

190<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

FRAME Element Object<br />

Properties<br />

borderColor<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

Although you may experience problems (especially in IE5) changing the color of<br />

a single frame border, the W3C DOM syntax would look like the following if the<br />

script were inside the framesetting document:<br />

document.getElementById(“contentsFrame”).borderColor = “red”<br />

The IE-only version would be:<br />

document.all[“contentsFrame”].borderColor = “red”<br />

These examples assume the frame name arrives to a script function as a string. If<br />

the script is executing in one of the frames of the frameset, add a reference to parent<br />

in the preceding statements.<br />

contentDocument<br />

FRAME.contentDocument<br />

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

Compatibility ✓<br />

Example<br />

A framesetting document script might be using the ID of a FRAME element to<br />

read or adjust one of the element properties, and then need to perform some action<br />

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

to the document 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

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

Saved successfully!

Ooh no, something went wrong!