批改状态:未批改
老师批语:
jquery 的引入是通过 <script> 标签将jquery脚本文件引入到html 文件中。
$(document).ready(function(){});
$(function(){});
示例代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jquery</title>
<style>
.header,.footer{
height: 88px;
line-height: 88px;
text-align: center;
font-size: 28px;
color: orange;
background-color: #abcdef;
}
.body{
width: 1200px;
height: 500px;
margin: auto;
line-height: 500px;
text-align: center;
font-size: 22px;
color: skyblue;
}
</style>
</head>
<body>
<div class="header">jquery 的引入示例</div>
<div class="body">jquery</div>
<div class="footer">End..</div>
<script src="public/jquery-3.2.1.js"></script>
<script>
$(document).ready(function(){
$(".body").css({
"background": "lightgreen",
"fontSize": 55,
"color": "#fff"
})
})
// $(function(){
// $("#body").css("color", "#1296db");
// })
</script>
</body>
</html>点击 "运行实例" 按钮查看在线实例
运行结果:

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号