abstrak:實(shí)在設(shè)計(jì)不出什么好案例,就寫了兩個(gè)事件:1--鼠標(biāo)點(diǎn)擊input框后,框會(huì)放大,點(diǎn)擊空白處,框恢復(fù)正常;2--鼠標(biāo)懸停在div,該div放大,移開后div恢復(fù)正常,代碼如下:<!doctype html> <html> <head> <meta charset="utf-8"> <title&g
實(shí)在設(shè)計(jì)不出什么好案例,就寫了兩個(gè)事件:
1--鼠標(biāo)點(diǎn)擊input框后,框會(huì)放大,點(diǎn)擊空白處,框恢復(fù)正常;
2--鼠標(biāo)懸停在div,該div放大,移開后div恢復(fù)正常,代碼如下:
<!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;" //點(diǎn)擊后input框變大 } function myblur(b){ b.style="margin-left:50px; width:200px; height:15px;" //失去焦點(diǎn)后恢復(fù)正常 } </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" //假裝這是一張美嬌娘,鼠標(biāo)懸停圖片放大; } function mymouseout(d){ d.style="margin:10px auto; width:80px; height:100px; background:orange" //鼠標(biāo)移開恢復(fù)正常; } </script> <div style="margin:10px auto; width:80px; height:100px; background:orange" onmouseover="mymouseover(this)" onmouseout="mymouseout(this)" > </div> </body> </html>
Guru membetulkan:韋小寶Masa pembetulan:2019-01-03 16:39:05
Rumusan guru:恩!已經(jīng)寫的很不錯(cuò)了!繼續(xù)加油吧!騷年!