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>热门推荐
8 送蛇的祝福语简短
10 领证幽默祝福语简短
11 俄语祝福语贺卡文案简短
12 生日宝宝祝福语简短独特
13 给长辈祝福语简短大全
14 周年庆典祝福语致辞简短
15 回家长的祝福语简短
16 发小结婚简短祝福语
17 我想找祝福语大全简短
18 祝寿时祝福语简短精辟