<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> </title>
<Script type = "text/javascript" src = "lib/jquery-1.5.2.js"> </script>
<Style type = "text/css">
. Red {
Background-color: red;
}
. Green {
Background: green;
}
</Style>
<Script type = "text/javascript">
$ (Function (){
// Obtain the html content of the First Matching Element. Cannot be used for xml, but can be used for xhtml
// Alert ($ ("div" example .html ());
// Set the html content of each element.
// $ ("Div [id = test2]" ).html ("Hello World ");
$ ("Div" functions .html (function (index, html ){
Return html + index;
});
});
</Script>
</Head>
<Body>
<Div>
<P> Hello </p>
</Div>
<Div id = "test2"> Zhonghua </div>
</Body>
</Html>
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> </title>
<Script type = "text/javascript" src = "lib/jquery-1.5.2.js"> </script>
<Style type = "text/css">
. Red {
Background-color: red;
}
. Green {
Background: green;
}
</Style>
<Script type = "text/javascript">
$ (Function (){
// Valid for both Html and xml.
// Text () obtains the content of all matching elements, including child elements.
// Text () <B> </B> is converted to an object.
$ ("Div"). text (function (index, text ){
Return $ ("p"). text () + text + index + "<B> depend on </B ";
});
});
</Script>
</Head>
<Body>
<P>
<B> Test </B> Paragraph.
</P>
<P> Paraparagraph </p>
<Div> I am div: </div>
</Body>
</Html>
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> </title>
<Script type = "text/javascript" src = "lib/jquery-1.5.2.js"> </script>
<Style type = "text/css">
. Red {
Background-color: red;
}
. Green {
Background: green;
}
</Style>
<Script type = "text/javascript">
$ (Function (){
// Obtain the values of a single select statement and the values of multiple select statements.
/*
$ ("P"). append (
"<B> Single: </B>" + $ ("# single"). val () + "<B> Multiple: </B>"
+ $ ("# Multiple"). val (). join (","));
*/
// Alert ($ ("input"). val ());
// Set the value of the text box.
$ ("Input [id]"). val ("hello World ");
$ ("# Single"). val ("Single2 ");
$ ("# Multiple"). val (["Multiple", "Multiple3"]);
$ ("Input"). val (["check2", "radio1"]);
$ (": Text. items"). val (function (){
Return this. value + "" + this. className;
});
});
</Script>
</Head>
<Body>
<P> </p>
<Br/>
<Select id = "single">
<Option> Single </option>
<Option> Single2 </option>
</Select>
<Select id = "multiple" multiple = "multiple">
<Option selected = "selected"> Multiple </option>
<Option> Multiple2 </option>
<Option selected = "selected"> Multiple3 </option>
</Select>
<Input type = "text" value = "some text"/>
<Input id = "test2" type = "text"/>
<Input type = "checkbox" value = "check1"/> check1
<Input type = "checkbox" value = "check2"/> check2
<Input type = "radio" value = "radio1"/> radio1
<Input type = "radio" value = "radio2"/> radio2
<Input type = "text" class = "items"/>
</Body>
</Html>
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> </title>
<Script type = "text/javascript" src = "lib/jquery-1.5.2.js"> </script>
<Style type = "text/css">
. Red {
Background-color: red;
}
. Green {
Background: green;
}
</Style>
<Script type = "text/javascript">
$ (Function (){
// It is useful to add element copies in the dom document to other elements.
// $ ("B"). clone (). prependTo ("p ");
// Clone (true), deep copy
$ ("Button"). click (function (){
$ (This). clone (true). insertAfter (this );
});
});
</Script>
</Head>
<Body>
<B> Hello </B>
<P>, how are you? </P>
<Button> Clone Me! </Button>
</Body>
</Html>
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
&