jquery基础精华04(01)

来源:互联网 发布:太平洋软件官方下载 编辑:程序博客网 时间:2024/05/21 19:31
<!DOCTYPE html>
<!--jQuery CSS-jQuery CSS方法-->
<html><head lang="en"> <meta charset="UTF-8"> <title></title> <script src="jquery-2.1.4.min.js"></script> <script src="js04.js"></script> <link type="text/css" href="css04.css" rel="stylesheet"></head><body> <!--注意这里没加class属性--> <div id="div01"></div></body></html>
js:
/** * Created by zsgjs038 on 2015/8/17. */$(document).ready(function(){    //用jquery引用css    $("#div01").addClass("style01");    $("#div01").click( function(){        $(this).toggleClass("style02");    });})
css:
.style01 {    width: 100px;    height: 100px;    background-color: #df6659;}.style02{    width: 100px;    height: 100px;    background-color: #2fa8ec;}



0 0
原创粉丝点击