using different functions javascript
I have this code below, I got the addList() function to work but the
secondPassed() is not working. I would like to output the the
secondPassed() in the label in the code. Any Help?
<!DOCTYPE html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
window.onload=function addList()
{
.....code goes here
}
window.onload = addList();
var seconds = 0;
function secondPassed() {
var minutes = Math.round((seconds - 30)/60);
var remainingSeconds = seconds % 60;
if (remainingSeconds < 10) {
remainingSeconds = "0" + remainingSeconds;
}
document.getElementById('countdown').innerHTML = minutes + ":" +
remainingSeconds;
if (seconds <60 ) {
seconds++;
}
}
var countdownTimer = setInterval('secondPassed()', 1000);
</script>
</head>
<body >
<table width="70%" border="1">
<tr>
<td colspan="2"> <label id = "countdown"
value="secondPassed()">0.00</label>
</td>
</tr>
<tr>
<td><p>How long did you balance</p>
<select id="selectNumber" ></select>
<label for="balance"> Seconds</label>
<p> </p></td>
<td>How did you find it?
<p>
<label>
<input type="radio" name="rGroup1" value="radio" id="rGroup1_0">
Easy</label>
<br>
<label>
<input type="radio" name="rGroup1" value="radio" id="rGroup1_1">
Fair</label>
<br>
<label>
<input type="radio" name="rGroup1" value="radio" id="rGroup1_2">
Challenging</label>
<br>
</p>
</td>
</tr>
</table>
</form>
</body>
</html>
I have tried using the two functions in two separate html pages and it
works well, but i am interested in using them both on the same html page.
No comments:
Post a Comment