Forum : loops
Brief description  about Online courses   join in Online courses
View nishant  gaurav 's Profile

loops

<html>
<body>
<form Name=myfrm5>
number is:<input type = text NAME = field1 SIZE = 5 value =""/>
<input type = button NAME = b1 VALUE = "break loop" onClick = "Module11();"/>
</form>
</body>
<head>
<script>
function Module11()
{
num = document.myform5.field1.value;
value=0;

if((num == 0) || (num > 100))
{
alert("Please Enter Number Between 1 - 100");
}
else
{
for(i=1 ; i<=100 ; i )
{
document.write(i "<br />");
if(i == num)
break;
}
document.write("<br />Loop Ended At User Given Value i.e. '" num " '");
}
}


</script>
</head>
</html>
still its not working.
Asked by nishant gaurav | Sep 5, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Nishant,

Please use form tag inside body and call respective js function there... check.
Sep 8, 2010