Forum : Javascript Loops assignment
Brief description  about Online courses   join in Online courses
View Ashika  Jain 's Profile

Javascript Loops assignment

Can any Kindly explain the following assignment:-
1)generate html page using javascript code, html page should have 10 text box. And each text box have incremental number of value.
2)3. Guessing any number between 1 to 20. while you not get correct number. For that use prompt() box.

Asked by Ashika Jain | Mar 16, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
hi Ashika,
Question1:
below is the code for this:

for(i=0;i<10;i++)
{
document.write("<input type='text' value="+i+">");
}


question2:

first guess any number, suppose it is 5

A=5;

now your loop will be running:
i=1;
while(i<=20)
{
if(i==A)
{
alert("your message");
break;
}
i++;
}
Mar 17, 2010