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.

popup Object<br />

Properties<br />

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

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

popup object and its properties. Enter the following statements into the top text<br />

box. The first statement creates a pop-up window, whose reference is assigned to<br />

the a global variable. Next, a reference to the body of the pop-up’s document is preserved<br />

in the b variable for the sake of convenience. Further statements work with<br />

these two variables.<br />

a = window.createPopup()<br />

b = a.document.body<br />

b.style.border = “solid 2px black”<br />

b.style.padding = “5px”<br />

b.innerHTML = “Here is some text in a popup window”<br />

a.show(200,100, 200, 50, document.body)<br />

See the description of the show() method for details on the parameters.<br />

isOpen<br />

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

Compatibility ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

isOpen property. Enter the following statements into the top text box. The<br />

sequence begins with a creation of a simple pop-up window, whose reference is<br />

assigned to the a global variable. Note that the final statement is actually two statements,<br />

which are designed so that the second statement executes while the pop-up<br />

window is still open.<br />

a = window.createPopup()<br />

a.document.body.innerHTML = “Here is a popup window”<br />

a.show(200,100, 200, 50, document.body); alert(“Popup is open:” + a.isOpen)<br />

201<br />

popupObject.isOpen

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

Saved successfully!

Ooh no, something went wrong!