Following code is counter which shows 10, 9, 8 till 1 then message box appears “BOOM”. “BOOM Now” is button which displays message box “BOOM”.
In IE
When you press “BOOM now” before countdown finished countdown stops till you press OK on message box
In Netscape
When you press “BOOM now” before countdown finished countdown still active and continue to work.
What I need
I would like message box in IE to behave similar to Netscape i.e. countdown should not stop.
[FONT=Courier New]<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Tester</title>
<script language=”javascript” type=”text/javascript”>
var timeLeft = 10;
function counter()
{
if(timeLeft>0)
{
document.getElementById(“timeLeft”).innerHTML = timeLeft;
timeLeft = timeLeft – 1;
setTimeout(‘counter()’, 1000);
}
else
alert(“BOOM”);
}
</script>
</head>
<body onload=”counter()”>
<div id=”timeLeft”></div>
<input name=”BOOM” value=”BOOM Now” type=”button” onclick=”alert(‘BOOM’)”/>
</body>
</html>[/FONT]