jQuery的基本语法

Original 2019-02-16 21:27:57 265
abstract:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>jQuery基本语法</title><script src="jqu/jq_3.3.1_mi.js"></script

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>jQuery基本语法</title>

<script src="jqu/jq_3.3.1_mi.js"></script>  //必须链接jQuery文件

<style>

.box{width: 300px;height: 300px;border: 1px solid #ccc;margin: 0px auto;background: gold;}

</style>

</head>

<body>

<div class="box"></div>

<button>点击变色变宽</button>

<script>


$(document).ready(function(){       //文档就绪函数

$('button').click(function(){       //获取button并点击

$('.box').css('background','red')   //改变背景颜色

$('.box').css('width','800px')      //改变DIV宽度

})

})

</script>

</body>

</html>


Correcting teacher:西门大官人Correction time:2019-02-17 09:33:48
Teacher's summary:作业写的很好。以后写js代码的时候,最好加上分号";"

Release Notes

Popular Entries