x
 
<!DOCTYPE html>
<html>
<body>
<p>本例演示如何将 "oninput" 事件分配给 input 元素。</p>
<p>请在文本字段中写一些内容来触发函数。</p>
输入姓名:<input type="text" value="Mickey" oninput="myFunction()">
<script>
function myFunction() {
  alert("The value of the input field was changed.");
}
</script>
</body>
</html>