您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

当HTML元素获得焦点时执行脚本?

2025/1/1 17:47:32发布19次查看
使用 onfocus 属性在 html 中获得焦点时执行脚本。
示例您可以尝试运行以下代码来实现 onfocus 属性 -
<!doctype html><html> <body> <p>enter subject name below,</p> subject: <input type = "text" id = "sname" onfocus = "display(this.id)"> <br> <script> function display(val) { document.getelementbyid(val).style.background = "blue"; } </script> </body></html>
以上就是当html元素获得焦点时执行脚本?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product