1<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title>2-4</title>6<link rel= "stylesheet" type= "Text/css" href= "Css/style.css"/>7<!--introducing jquery--8<script src= ". /scripts/jquery.js "type=" Text/javascript "></script>9<script src= "Lib/assist.js" type= "Text/javascript" ></script>Ten One<script type= "Text/javascript" > A$ (document). Ready (function(){ - //Select an element with an ID of one -$ (' #btn1 '). Click (function(){ the$ (' #one '). CSS ("Background", "#bfa"); - }); - - //Select all elements of class mini +$ (' #btn2 '). Click (function(){ -$ ('. Mini '). CSS ("Background", "#bfa"); + }); A at //Select element name is all elements of div -$ (' #btn3 '). Click (function(){ -$ (' div '). css ("Background", "#bfa"); - }); - - //Select all the elements in$ (' #btn4 '). Click (function(){ -$ (' * '). CSS ("Background", "#bfa"); to }); + - //Select all the span elements and the DIV element with ID the$ (' #btn5 '). Click (function(){ *$ (' span, #two '). CSS ("Background", "#bfa"); $ }); Panax Notoginseng }); -</script> the +<body> A the<button id= "reset" > Reset page elements manually </button> +<input type= "checkbox" id= "Isreset" checked= "checked"/><label for= "isreset" > Reset page automatically when clicking the button below </label ><br/><br/> - $ $<!--control buttons-- -<input type= "button" value= "selects the element with ID one." id= "Btn1"/> -<input type= "button" value= "selects all elements of Class Mini." Id= "btn2"/> the<input type= "button" value= "SELECT element name is all elements of Div." id= "Btn3"/> -<input type= "button" value= "selects all elements." id= "Btn4"/>Wuyi<input type= "button" value= "selects all of the span elements and the element with ID." Id= "Btn5"/> the -<br/><br/> Wu -<!--test Elements-- About<div class= "One" id= "one" > $ div with id one,class as one -<div class= "Mini" >class for mini</div> -</div> - A<div class= "One" id= "one" title= "Test" > + The div with ID two,class is one,title as test. the<div class= "Mini" title= "other" >class Mini,title for Other</div> -<div class= "Mini" title= "test" >class Mini,title for Test</div> $</div> the the<div class= "One" > the<div class= "Mini" >class for mini</div> the<div class= "Mini" >class for mini</div> -<div class= "Mini" >class for mini</div> in<div class= "Mini" ></div> the</div> the About<div class= "One" > the<div class= "Mini" >class for mini</div> the<div class= "Mini" >class for mini</div> the<div class= "Mini" >class for mini</div> +<div class= "Mini" title= "Tesst" >class to Mini,title for tesst</div> -</div> the Bayi the<div style= "Display:none;" class= "None" > theThe style's display is "none"the Div -</div> - the<div class= "Hide" >class as "Hide" div</div> the the<div> theContains the type of input "hidden" div<input type= "hidden" size= "8"/> -</div> the the<span id= "Mover" > the span element in which the animation is being performed .</span> the 94</body> the
-
- $ (' #one '). CSS ("Background", "#bfa"); Change the background color of an element with ID one.
-
- $ ('. Mini '). CSS ("Background", "#bfa"); Change the background color of all elements of class mini
-
- $ (' div '). css ("Background", "#bfa"); Changing the element name is the background color of all elements of <div>
-
- $ (' * '). CSS ("Background", "#bfa"); Change the background color of all elements
-
- $ (' span, #two '). CSS ("Background", "#bfa"); Change the background color of all <span> elements and the element with ID
jquery Basic Learning 6--Base Selector