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.

156<br />

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

Listing 16-22 (continued)<br />

var endTime = null<br />

var timerID = null<br />

function startTimer() {<br />

running = true<br />

now = new Date()<br />

now = now.getTime()<br />

// change last multiple for the number of minutes<br />

endTime = now + (1000 * 60 * 1)<br />

showCountDown()<br />

}<br />

function showCountDown() {<br />

var now = new Date()<br />

now = now.getTime()<br />

if (endTime - now <br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

windowObject.clearTimeout()

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

Saved successfully!

Ooh no, something went wrong!