x
 
<!DOCTYPE html>
<html>
<body>
<p>本例演示如何将 "onsearch" 事件分配给 input 元素。</p>
<p>请在搜索字段中输入一些内容,然后按“ENTER”。</p>
<input type="search" id="myInput" onsearch="myFunction()">
<p><b>注释:</b>Internet Explorer、Firefox 或 Opera 12 及更早版本不支持 onsearch 事件。</p>
<p id="demo"></p>
<script>
function myFunction() {
   var x = document.getElementById("myInput");
   document.getElementById("demo").innerHTML = "You are searching for: " + x.value;
}
</script>
</body>
</html>