摘要:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml&quo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js事件</title>
</head>
<body>
<script type="text/javascript">
function myfocus(x){x.style.background="pink"}
function mymouseover(y){y.style.background="red"}
//function myclick(z){z.style.background="blue"}
function myclick(a){a.style.borderRadius="50px"}
</script>
姓名:<input type="text" onfocus="myfocus(this)">
年齡:<input type="text" onmousemove="mymouseover(this)">
<br>
<br>
<div style=" width:100px; height:100px; border:1px solid #999; background:#060" onclick="myclick(this)">
</div>
</body>
</html>
// 常用JS事件
/*
onfocus 元素獲得焦點
onchange HTML 元素改變
onclick 用戶點擊 HTML 元素
onload 頁面加載完成
onmousemove 鼠標被移動
onmouseover 用戶在一個HTML元素上移動鼠標
onkeydown 某個鍵盤被按下
*/
批改老師:韋小寶批改時間:2018-12-24 18:02:33
老師總結(jié):總結(jié)的很不錯!課后記得多使用多總結(jié)哦!!