jquery 对css和js的导入和运用

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/样式.css" />
<script type="text/javascript" src="js/jquery-3.7.1.js" ></script>
<script type="text/javascript" src="js/功能.js" ></script>
</head>
<body>
<div>
<h1>玉溪农业职业学院</h1>
<p>信息电气工程学院</p>
<button>按钮</button>
<hr />
</div>
</body>
</html>

 

css部分

h1{
background-color: blueviolet;
font-size: 40px;
color: coral;
}
p{
background-color:aquamarine;
font-size: 30px;
color: darkgoldenrod;
}
button{
width: 100px;
height: 50px;
}
div{
background-color: black;
}

 

js部分

$(document).ready(function(){
$("button").hover(function(){
$("div").css("background-color","aliceblue")
},function(){
$("div").css("background-color","aqua")

})
$("button").dblclick(function(){
$("h1").css("background-color","crimson")
})

})

posted on 2024-11-09 11:03  蓯芯開矢  阅读(1)  评论(0编辑  收藏  举报