摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Js事件</title> <style type="text/css"> .cls{ width:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Js事件</title> <style type="text/css"> .cls{ width: 100px; height: 100px; border: 1px solid #ccc; } </style> <script type="text/javascript"> // 獲取焦點(diǎn)事件 function myfocus(s){ s.style.background = 'pink'; } // 失去焦點(diǎn)事件 function myblur(s) { s.style.background = 'none'; } // 鼠標(biāo)移入事件 function myOver(s) { s.style.borderRadius = '50px' s.style.background = 'red'; } function myOut(s){ s.style.background = 'blue'; } </script> </head> <body> 姓名: <input type="text" onfocus="myfocus(this)" onblur="myblur(this)" name=""> <div class="cls" onmouseover="myOver(this)" onmouseout="myOut(this)"></div> </body> </html>
批改老師:查無此人批改時間:2019-03-18 09:28:24
老師總結(jié):完成的不錯,js事件有很多,記住常用的幾個就行了。繼續(xù)加油。