<html>
<body>
<p>本例使用 HTML DOM 将 "oninput" 事件分配给 input 元素。</p>
<p>请在文本字段中写一些内容来触发函数。</p>
Enter name: <input type="text" id="myInput" value="Mickey">
<script>
document.getElementById("myInput").oninput = function() {myFunction()};
function myFunction() {
alert("The value of the input field was changed.");
}
</script>
</body>
</html>