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.

160<br />

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

The method returns no value, so the mechanism inside The Evaluator says that the<br />

statement is undefined.<br />

a<br />

The variable is now 5.<br />

window.execScript(“b = a * 50”)<br />

b<br />

The b global variable has a value of 250. Continue exploring with additional<br />

script statements. Use semicolons to separate multiple statements within the string<br />

parameter.<br />

find([“searchString” [, matchCaseBoolean,<br />

searchUpBoolean]])<br />

Compatibility ✓<br />

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

Example<br />

A simple call to the window.find() method looks as follows:<br />

var success = window.find(“contract”)<br />

If you want the search to be case-sensitive, add at least one of the two optional<br />

parameters:<br />

success = wind.find(matchString,caseSensitive,backward)<br />

Because this method works only in NN4, refer to discussions of the TextRange<br />

and Range objects in Chapter 19 of the <strong>JavaScript</strong> <strong>Bible</strong> for more modern implementations<br />

of body text searching.<br />

GetAttention()<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>) in NN6 to set a timer that<br />

gives you enough time to switch to another application and wait for the attention<br />

signal to fire. Enter the following statement into the top text box, click the Evaluate<br />

button, and then quickly switch to another program:<br />

setTimeout(“GetAttention()”, 5000)<br />

After a total of five seconds, the attention signal fires.<br />

windowObject.GetAttention()

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

Saved successfully!

Ooh no, something went wrong!