摘要:實在設(shè)計不出什么好案例,就寫了兩個事件:1--鼠標點擊input框后,框會放大,點擊空白處,框恢復正常;2--鼠標懸停在div,該div放大,移開后div恢復正常,代碼如下:<!doctype html> <html> <head> <meta charset="utf-8"> <title&g
實在設(shè)計不出什么好案例,就寫了兩個事件:
1--鼠標點擊input框后,框會放大,點擊空白處,框恢復正常;
2--鼠標懸停在div,該div放大,移開后div恢復正常,代碼如下:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>js事件作業(yè)</title> </head> <body> <script type="text/javascript"> function myfocus(a){ a.style="margin-left:50px; width:200px; height:30px;" //點擊后input框變大 } function myblur(b){ b.style="margin-left:50px; width:200px; height:15px;" //失去焦點后恢復正常 } </script> <input type="text" style="margin-left:50px; width:200px; height:15px;" onfocus="myfocus(this)" onblur="myblur(this)"> </br> <script> function mymouseover(c){ c.style="margin:10px auto; width:160px; height:200px; background:orange" //假裝這是一張美嬌娘,鼠標懸停圖片放大; } function mymouseout(d){ d.style="margin:10px auto; width:80px; height:100px; background:orange" //鼠標移開恢復正常; } </script> <div style="margin:10px auto; width:80px; height:100px; background:orange" onmouseover="mymouseover(this)" onmouseout="mymouseout(this)" > </div> </body> </html>
批改老師:韋小寶批改時間:2019-01-03 16:39:05
老師總結(jié):恩!已經(jīng)寫的很不錯了!繼續(xù)加油吧!騷年!