Next, replace f = parseInt(document.getElementById('fn'); with
f = parseInt(document.getElementById('fn').v...
Firstly, we're putting in an ending parenthesis ')', second, we're specifying that we want the VALUE of this input box.
Next, when initiating the loop, you need to initiate it by saying:
for (var i=f; i
As you have it, you've got an undefined variable, that you then assign a value of an HTML DOM object.
Finally, do you want it to report the numbers like "2", THEN "3", THEN "4", or do you want it to just list all numbers at the end? Either way, you need to move the "result+=i+' '" INSIDE the loop.
http://jsfiddle.net/ruv52by8/
line 5, result="; you need another quote
write a javascript program in html that will allow user to enter first number and last number, and when user clicks on a display button it will display all number inclusively
what i've done so far
function display(){
result=";
var f, l;
f = parseInt(document.getElementById('fn');
l = parseInt(document.getElementById('ln');
for (i=fn;i
{
alert(result)
}
}
the program doesnt run correctly as i desire, can anyone correct where there is a mistake