
onsearch 事故对于于搜刮颇有用,即用户正在输出元艳外按 ENTER 或者“x”键。 的范例是search,由于它是求用户搜刮的。 Internet Explorer、Firefox 以及 Opera 没有支撑 onsearch 变乱。
事例
你否以测验考试运转下列代码来相识怎样正在 JavaScript 外完成 onsearch 事变。
<!DOCTYPE html>
<html>
<body>
<p>Write what you want to search below and press "ENTER".</p>
<input type = "search" id = "newInput" onsearch = "searchFunc()">
<script>
function searchFunc() {
var a = document.getElementById("newInput");
document.write("Searched = " + a.value);
}
</script>
</body>
</html>登录后复造
以上即是正在JavaScript外,onsearch事变的用法是甚么?的具体形式,更多请存眷萤水红IT仄台别的相闭文章!

发表评论 取消回复