[JavaScript] 文本输入框获得焦点时触发事件的JS代码演示 →→→→→进入此内容的聊天室

来自 , 2020-05-18, 写在 JavaScript, 查看 154 次.
URL http://www.code666.cn/view/a860a788
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function myFunction(x)
  6. {
  7. x.style.background="yellow";
  8. }
  9. </script>
  10. </head>
  11. <body>
  12.  
  13. Enter your name: <input type="text" onfocus="myFunction(this)">
  14.  
  15. <p>When the input field gets focus, a function is triggered which changes the background-color.</p>
  16.  
  17. </body>
  18. </html>
  19.  
  20. //javascript/7960

回复 "文本输入框获得焦点时触发事件的JS代码演示"

这儿你可以回复上面这条便签

captcha