PDA

View Full Version : adding multiple loops to code


cat_evilness
11-23-2002, 09:20 PM
Hey guys,

can anyone tell me what to do to the code below to repeat the same
action for a few other variables. Like how do i add multiple links?

<html>
<head>
<script language="javascript">
<!--
var countdownValue='10';

function countdownScript(){
if(countdownValue>=10){
countdownValue=10
}
countdown.innerHTML=countdownValue;
if(countdownValue<=0){
clearTimeout(Timer)
}
else{
countdownValue--;
Timer=setTimeout("countdownScript();", 3000);
}
}

function hmm(){
clearTimeout(Timer)
countdownValue+=2
countdownScript()
}

onload=countdownScript
//-->
</script>
<title>Virtual Pet - Version 1.0</title>
</head>
<body bgcolor="#FF9900" text="#ffff99" link="#00ff00" alink="#ffa500" vlink="#ff0000">
<basefont size="3">
<table width="220" valign="top" border="0">
<tr>
<td width="180" bgcolor="#000000" valign="left" align="left" border="0">
Mood:</br>
</td>
<td width="40" bgcolor="#000000" valign="left" align="left" border="0">
<span id="countdown"></span></br>
</td>
</tr>
</table>

<form name=f1>
<input type="button" value="Button" onclick="hmm()">
</form>
</body>
</html>

Thankyou,
Cat