DubbDesigns
10+ year member
CarAudio.com Veteran
My friend is trying to create a script not sure what for but he said he want the alert box to pop up when the counter gets to a certain number. Iam not good with javascript*. Does anyone know how to make it work.
Code:
<html>
<head>
<script type="text/javascript">
var c=0;
var t;
if (timedCount() > "3")
{
alert("<b>Lunch-time!</b>");
}
function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}
function stopCount()
{
clearTimeout(t);
}
</script>
</head>
<body>
<form>
<input type="button" value="Start count!" onClick="timedCount()">
<input type="text" id="txt">
<input type="button" value="Stop count!" onClick="stopCount()">
</form>
<p>
Click on the "Start count!" button above to start the timer. The input
field will count forever, starting at 0. Click on the "Stop count!"
button to stop the counting.
</p>
</body>
<head>
<script type="text/javascript">
function disp_alert()
if (c==1)
{
alert(c-1);
}
</script>
</head>
<body>
<input type="button" onclick="disp_alert()" value="Display alert box" />
</body>
</html>