abstrait:<!DOCTYPE html> <html> <head> <title>事件作業(yè)</title> </head> <body> <script type="text/javascript"> //
<!DOCTYPE html> <html> <head> <title>事件作業(yè)</title> </head> <body> <script type="text/javascript"> // onfocus 元素獲得焦點。 function myfovus(x) { x.style.background="blue" } function myfovus2(y) { y.style.background="red" } </script> <!-- onfocus對div無效,無法再div中獲取焦點 --> <div style="width: 100px;height: 100px;border: 1px solid #ccc; background: pink;" onfocus="myfovus(this)"> <input type="" name="" onfocus="myfovus2(this)" > </div> <script type="text/javascript"> // onblur 元素失去焦點。 function myonblur(x) { x.style.background="blue" } function myonblur1(y) { y.style.background="red" } </script> <!-- onblur對div無效 --> <!-- onfocus對input生效 --> <div style="width: 100px;height: 100px;border: 1px solid #ccc; background: pink;" onblur="myonblur(this)"> <input type="" name="" onblur="myonblur1(this)"> </div> <script type="text/javascript"> // onchange 域的內(nèi)容被改變。 function myonchange(x) { x.style.background="blue" } function myonchange1(y) { y.style.background="red" } </script> <!-- 當文本域中的更改后,div和input的狀態(tài)改變 --> <div style="width: 100px;height: 100px;border: 1px solid #ccc; background: pink;" onchange="myonchange(this)"> <input type="" name="" onchange="myonchange1(this)"> </div> <script type="text/javascript"> // onclick 當用戶點擊某個對象時調(diào)用的事件句柄。 function myonclick(x) { x.style.background="blue" } function myonclick1(y) { y.style.background="red" } </script> <div style="width: 100px;height: 100px;border: 1px solid #ccc; background: pink;" onclick="myonclick(this)"> <input type="" name="" onclick="myonclick1(this)"> </div> <script type="text/javascript"> // ondblclick 當用戶雙擊某個對象時調(diào)用的事件句柄。 function myondblclick(x) { x.style.background="blue" } function myondblclick1(y) { y.style.background="red" } </script> <div style="width: 100px;height: 100px;border: 1px solid #ccc; background: pink;" onclick="myondblclick(this)"> <input type="" name="" onclick="myondblclick1(this)"> </div> </div> </body> </html>
Professeur correcteur:天蓬老師Temps de correction:2018-12-08 17:27:50
Résumé du professeur:現(xiàn)代網(wǎng)頁,全是基于事件驅(qū)動的,這與操作系統(tǒng)非常像, 事件很重要也很有意思