您好,欢迎访问一九零五行业门户网

在JavaScript中,onsearch事件的用法是什么?

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事件的用法是什么?的详细内容。
其它类似信息

推荐信息