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>热门推荐
5 简短元宵节祝福语
10 新年孕妈祝福语简短
11 新单位成立祝福语简短
12 祝福语精选简短正能量
13 牛年企业祝福语简短大气
14 商务感恩祝福语大全简短
15 中秋祝福语简短带署名
16 写春节祝福语简短的
17 考上大学简短祝福语、
18 爷爷生日会祝福语简短