This code opens a new popup window that contains a timer that counts down, then closes the window when it reaches 0. Will not work if user has a popup blocker blocking the page.
<html>
<head>
<title>Popup Timer</title>
<script language="JavaScript" type="text/JavaScript">
// popup window var
var popup;
// At what number shall the countdown counter start?
CounterStart = 10;
// This function CustomAction() can be modified to do
// whatever you want done every second.
function CustomAction() {
popup.document.timer.timeleft.value = CounterStart;
} // end of function CustomAction()
// end of JavaScript customization
function Decrement() {
CounterStart--;
CustomAction();
if(CounterStart <= 0) { popup.close(); alert('Timer reached 0'); }
else { setTimeout('Decrement()',1000); }
}
function StartTheCounter() {
openPopup(120,100);
setTimeout('Decrement()',1000);
}
f...
Comments
I also would like to ask you a question: It is a known bug that, when applying this plugin and using it on Opera, the Tab Key doesn't work? The Backslash key doesn't work either. But in all the other browsers it works fine...even on IE6