abstrakt:<!DOCTYPE html /><html> <head> <meta charset="utf-8" /> <title>jquery事件方法</title>  
<!DOCTYPE html />
<html>
<head>
<meta charset="utf-8" />
<title>jquery事件方法</title>
<script type="text/javascript" src="jquery-3.3.1.js"></script>
<style type="text/css">
div{
width:100px;
height:100px;
background:#eee;
}
</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
$('#one').focus(function(){ //當(dāng)元素獲得焦點(diǎn)時(shí)
$('#one').css('background','blue')
})
$('#one').blur(function(){ //當(dāng)元素失去焦點(diǎn)時(shí)
$('#one').css('background','red')
})
$('#tw').change(function(){ //當(dāng)元素的值發(fā)生改變時(shí)
$('#tw').css('background','#ccc')
})
$('#cl').click(function(){ //當(dāng)元素被單擊時(shí)
$('#one').css('width','250px')
})
$('#dbl').dblclick(function(){ //當(dāng)元素被雙擊時(shí)
$('#tw').css('height','50px')
})
$('div').mouseover(function(){ //當(dāng)鼠標(biāo)在元素上方時(shí)
$('div').css('background','red')
})
$('div').mouseout(function(){ //當(dāng)鼠標(biāo)離開元素上方時(shí)
$('div').css('background','blue')
})
$('div').mouseup(function(){ //當(dāng)鼠標(biāo)在元素上方松開時(shí)
$('div').css('background','pink')
})
$('div').mousedown(function(){ //當(dāng)鼠標(biāo)在元素上方按下時(shí)
$('div').css('background','green')
})
$('#tt').mouseenter(function(){ //當(dāng)鼠標(biāo)穿過元素時(shí)
$('#tt').css('color','red')
})
$('#tt').mousemove(function(){ //當(dāng)鼠標(biāo)在元素中移動(dòng)時(shí)
$('#tt').css('background','grey')
})
a=0
$(window).resize(function(){ //當(dāng)窗口進(jìn)行調(diào)整時(shí),返回調(diào)整次數(shù)
$('h5').text(a++)
<!-- alert('fjakj ') -->
})
$(document).mouseover(function(aa){ //返回鼠標(biāo)在文檔中距離左邊與上邊的位置
$('span').text('x:'+aa.pageX+'Y:'+aa.pageY)
})
$('#ss').hover( //當(dāng)鼠標(biāo)移上/移除元素時(shí)進(jìn)行切換
function(){
$('#ss').css('background','red')
},function(){
$('#ss').css('background','blue')
}
)
$('#ii').click(function(){ //對(duì)元素進(jìn)行顯示/隱藏切換
$('#rr').toggle().css('color','pink')
})
})
</script>
<input type="text" id="one" />
<br>
<input type="text" id="tw" />
<br>
<button id="cl">click</button>
<br>
<button id="dbl">dblclick</button>
<hr />
<div>阿斯蒂芬那里風(fēng)景</div>
<br>
<p id="tt">阿斯蒂芬那里風(fēng)景</p>
<br>
<h5></h5>
<span></span>
<br><br><br>
<a id="ss">esdfasdffasdfaf</a>
<br><br><br>
<h1 id="rr">hskdfalsdjasl</h1>
<button id="ii">click</button>
</body>
</html>
Korrigierender Lehrer:查無此人Korrekturzeit:2019-03-09 09:15:55
Zusammenfassung des Lehrers:完成的不錯(cuò)。js代碼,每行語句后面增加;號(hào),養(yǎng)成好習(xí)慣。繼續(xù)就加油。