<html>
<body>
<p>在搜索文本域中输入信息并按下 "ENTER" 键。</p>
<input type="search" id="myInput" onsearch="myFunction()">
<p><strong>注意:</strong>Internet Explorer, Firefox 或 Opera 12 及其更早版本不支持 onsearch 事件。</p>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myInput");
document.getElementById("demo").innerHTML = "您搜索的内容为:" + x.value;
}
</script>
</body>
</html>