jquery is a set of Javascript script libraries, including:jquery core Components,jquery UI components, Jquery extension Components
Compatible with a wide range of mainstream browsers currently available on the market
<script type="text/javascript"> <!-- $ ( function () { Alert (""); } ); // - </script>
<!doctype html>"en"> "UTF-8"> <meta name="Generator"Content="editplus®"> <meta name="Author"Content=""> <meta name="Keywords"Content=""> <meta name="Description"Content=""> <title>Document</title> <script type="Text/javascript"Src="Jquery-1.3.2.js"> </script> "Text/javascript"> <!--$ (function () {//alert ("equivalent to onload event"); } ); // -</script><table border="1" class="mytable"style="Display:none"><tr> <td>dffd</td> <td>dfffffff</td> <td>dffffff</td></tr>< ;tr> <td>dffd</td> <td>dfffffff</td> <td>dffffff</td></tr><tr> <td>dffd</td> <td>dfffffff</td> <td>dffffff</td></tr><tr> < ;td>dffd</td> <td>dfffffff</td> <td>dffffff</td></tr></table>< Input type="Button"Value="Enter" class="Enter"> <input type="Button"Value="Exit" class="Exit"><script type="Text/javascript"><!--//$ (". MyTable"). Show ();$(". Enter"). Bind ("Click", Function () {$ (". MyTable"). FadeIn ( +);//; show (); }) $(". Exit"). Bind ("Click", Function () {$ (". MyTable"). FadeOut ()//hide (); })// -</script> </body>The $ (". Exit") function is to select an HTML element in an HTML document , which is a jquery object. The selected parameter is the name of the CSS selector.
Jqueryobjects, andDomObjectThe jquery object is called the jquery wrapper set for the Dom .
The objects that are obtained with the jquery function are the jquery Wrapper set objects. Only jquery objects can invoke functions in the jquery library;
Dom objects can only use traditional dom functions
Two objects can be converted between
the Dom object is converted to a jquery Wrapper set object:
$ (Dom object )
<script type="text/javascript"><!-- var mytable= document.getElementById ("mytable"); // alert (mytable.nodename); $ (mytable). Show (); // -</script>
to convert a Jquery object to a Dom object method:
Jquery Object [0]
<script type= text/javascript ><!--var mytable= document.getElementById ( mytable " Span style= "color: #800000;" > " ); // alert (Mytable.nodename); var jqueryobject=$ (MyTable); Jqueryobject.show ( 1000 ); var domobject=jqueryobject[0 Span style= "color: #000000;" >]; alert (domobject.nodename); // --> </script>
JquerytheHTMLthe Operation
<div id= "Mydiv" ></div> <script type= "Text/javascript" > <!-- <p>lasdf<b>jadf</b>asdfasdf</p> /* var Mydiv=document.getelementbyid ("Mydiv"); var pele=document.createelement ("P"); Pele.appendchild (document.createTextNode ("LASDF")); var bele=document.createelement ("B"); Bele.appendchild (document.createTextNode ("JADF")); Pele.appendchild (Bele); Pele.appendchild (document.createTextNode ("ASDFASDF")); Mydiv.appendchild (Pele); */ $ ("<p>lasdf<b>jadf</b>asdfasdf</p>"). AppendTo ("#mydiv"); $ ("#mydiv"). Append ("<p>lasdf<b>jadf</b>asdfasdf</p>"); /* var pele=$ ("<p>"); Pele.append ("Lasdf"); var bele=$ ("<b>"); Bele.append ("JADF"); Pele.append (Bele); Pele.append ("Asdfasdf"); $ ("#mydiv"). Append (Pele); */ var pele=$ ("<p>") Pele.append ("Lasdf"). Append ("<b>jadf</b>"). Append ("Asdfasdf"); $ ("#mydiv"). Append (Pele); - </script> |