1

我编写了一个非常简单的 JavaScript 函数来接受数字输入并将其作为段落元素的 innerHTML 显示在屏幕上。该函数被命名为“multiple”(参见下面的代码)。那没起效。

但是,将函数名称更改为“myMultiple”可以使脚本正常工作。我在保留的 JavaScript 单词列表中看不到“多个” - 是其他原因导致此错误吗?

<body>

<p>Write something in the text field to trigger a function.</p>

<input type="text" id="funcnTest" oninput="multiple()">
<p id="myOutput"></p>

<script>
function multiple() {
    var myInputVal = document.getElementById("funcnTest").value;
    document.getElementById("myOutput").innerHTML = "The value: " + myInputVal;
}
</script>

</body>
4

0 回答 0