The code does not run because of the following issues
function multiple ( ). Though there is a closing } but there is no opening { which mark the start of function body.
The function body should be inside { } . Example
function multiple() { //Rest of code}
for (i=pooya;i<=5;i++){}. This part will not work. pooya is a an id to an element & if you are assigning it to a i. If you want to do that initialize pooya with some value
document.getElementById("pooya").innerHTML = i . Are you trying to update the input box? If so then you have to use document.getElementById("pooya").value = i
In this case you will always see 5 as updated value in input box.
If you do document.getElementById("pooya").innerHTML += iyou will see4
"entered value"+12345;
Example:If you give input asthe input box will be updated with4012345`
Check this JSFIDDLE
EDIT
function multiple ( ){
var i= document.getElementById("pooya").value; // Will take the entered value
document.getElementById("pooya").value=""; // will empty the inpt
for(i;i<=5;i++){
document.getElementById("pooya").value += i; // will update input box
}
}
2
solved JavaScript for loop [closed]