JavaScript中oninput事件的用途是什么?
在输入框中添加值时,将发生oninput事件。您可以尝试运行以下代码以了解如何在JavaScript中实现oninput 事件-
示例
<!DOCTYPE html>
<html>
<body>
<p>Write below:</p>
<input type = "text" id = "newInput" oninput = "inputFunc()">
<p id = "demo"></p>
<script>
function inputFunc() {
var a = document.getElementById("newInput").value;
document.write("Typed: " + a);
}
</script>
</body>
</html>热门推荐
10 公司文案生日祝福语简短
11 朋友搬迁新房祝福语简短
12 科研文案祝福语简短励志
13 新年恋人祝福语简短创意
14 對好友毕业祝福语简短
15 二胎祝福语简短霸气
16 祝福语对联文案简短大气
17 同事们生日祝福语简短
18 表达家人的祝福语简短