使用jQuery基本选择器选择元素
使用jQuery基本选择器选择元素:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>使用jQuery基本选择器</title>
- <script language="javascript" type="text/javascript"
- src="../Jscript/jquery-1.5.2.js"></script>
- <style type="text/css">
- body{font-size:12px;text-align:center}
- .clsFrame{width:300px;height:100px}
- .clsFrame div,span{display:none;float:left;
- width:65px;height:65px;border:solid 1px #ccc;margin:8px}
- .clsOne{background-color:#eee}
- </style>
- <script type="text/javascript">
- $(function(){ //ID匹配元素
- $("#divOne").css("display","block");
- })
- $(function(){ //元素名匹配元素
- $("div span").css("display","block");
- })
- /* $(function(){ //类匹配元素
- $(".clsFrame .clsOne").css("display","block");
- })*/
- $(function(){ //匹配所有元素
- $("*").css("display","block");
- })
- /* $(function(){ //合并匹配元素
- $("#divOne,span").css("display","block");
- })*/
- </script>
- </head>
- <body>
- <div class="clsFrame">
- <div id="divOne">ID</div>
- <div class="clsOne">CLASS</div>
- <span>SPAN</span>
- </div>
- </body>
- </html>
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20