WTAD Practical-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.
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>WTAD.practical-4 @iAmLearningHere </TITLE>
</HEAD>
<script type="text/javascript">
function start()
{
setTimeout("displayMultiple()", 10000); // time in millisecond
}
function displayMultiple()
{
var i = 1;
document.write(" [ ");
for(i=1; i<=10000; i++)
{
if(i%10==0 )
document.write(i + ' , ');
}
document.write(" ] ");
}
</script>
<BODY>
<FORM>
<input type="button" name="btStarter" value="Click To Start" onclick="start()"/>
</FORM>
</BODY>
</HTML>
<HEAD>
<TITLE>WTAD.practical-4 @iAmLearningHere </TITLE>
</HEAD>
<script type="text/javascript">
function start()
{
setTimeout("displayMultiple()", 10000); // time in millisecond
}
function displayMultiple()
{
var i = 1;
document.write(" [ ");
for(i=1; i<=10000; i++)
{
if(i%10==0 )
document.write(i + ' , ');
}
document.write(" ] ");
}
</script>
<BODY>
<FORM>
<input type="button" name="btStarter" value="Click To Start" onclick="start()"/>
</FORM>
</BODY>
</HTML>
0 comments :