摘要:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Document</title> <script type="text/javascript" sr
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Document</title>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<style type="text/css">
div,p{width: 200px;height: 200px;border: 1px solid #ccc;}
</style>
</head>
<body>
<script type="text/javascript">
// hover(over,out)
// over:鼠標(biāo)移上元素上要觸發(fā)的一個(gè)函數(shù)
// out:鼠標(biāo)移出元素上要觸發(fā)的一個(gè)函數(shù)
$(document).ready(function(){
// $('div').hover(
// function(){
// $(this).css('background','red')
// },
// function(){
// $(this).css('color','#fff')
// }
// )
// toggle() 如果元素是可見(jiàn)的,就切換為隱藏,否則相反
$('button').click(function(){
$('p').toggle().css('background','red')
})
})
</script>
<div>我是內(nèi)容</div>
<p style="display: none;"></p>
<button>點(diǎn)擊</button>
</body>
</html>
批改老師:滅絕師太批改時(shí)間:2019-03-22 09:11:32
老師總結(jié):除了練習(xí)上課內(nèi)容,下次作業(yè)希望可以帶自己拓展案例!