【发布时间】:2016-08-26 17:51:59
【问题描述】:
我不知道为什么我的代码无法运行,有人可以帮助我吗?
<!DOCTYPE html>
<html>
<head>
<title>
excerise
</title>
<style></style>
</head>
<body>
<script>
function multiple ( )
var i=0;
for (i=pooya;i<=5;i++)
{
document.getElementById("pooya").innerHTML = i;
}
}
</script>
number<br>
<input type="text" id="pooya">
<button onclick=" multiple ()">try it</button>
<p>Explanation:</p>
<p>This for loop starts with i=0.</p>
<p>As long as <b>i</b> is less than, or equal to 5, the loop will continue to run.</p>
<p><b>i</b> will increase by 1 each time the loop runs.</p>
</body>
</html>
【问题讨论】:
-
document.getElementById("pooya").value = i; -
不要一遍又一遍地重复同一个句子,这至少没有帮助。描述您正在尝试做的事情,以及您遇到的问题
-
试试
document.getElementById("pooya").value += i; -
缺少
{。下次使用JSHint 确保您没有此类拼写错误。
标签: javascript