postheadericon 4. Write a JavaScript that finds out multiples of 10 in 0 to 10000. On the click of button start the timer and stop the counter after 10 seconds. Display on the screen how many multiples of 10 are found out within stipulated time.




<html>
<head>
<title>EX-4: WTAD : www.bipinrupadiya.com</title>
<head>
<script type="text/javascript">
function StartTimer()
{
setTimeout ("doMyTask()", 10000);
}
function doMyTask()
{
var i = 1;
for(i=1;i<10000;i++)
if(i%10==0)
document.write(i + ' , ');
}
</script>
</head>
<body>
<form name=f1>
<input type="button" name="clickMe" value="Click Me...!" onclick="StartTimer()"/>
</form>
</body>
</html>

0 comments:

Follow by Email

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.