<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "default. aspx. cs" inherits = "jquerypro. _ default" %>
<! 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 runat = "server">
<Title> jquery test </title>
<SCRIPT type = "text/JavaScript" charset = "gb2312" src = "JS/jquery3.2.js"> </SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div id = "idhelloworld"> <p> Hello </P> </div>
<Input type = "text" id = "idkey" value = ""/>
<Input type = "button" id = "idbutton" value = "add function123 --"/>
<Table>
<Tr> <TD> <input type = "button" value = "testjquery" onclick = 'alert ($ ("# idhelloworld" example .html ("Hellworld Wang detian ")) '/> </TD> </tr>
<Tr> <TD> <input type = "button" value = "testjquery" onclick = 'alert ($ ("# idkey "). ATTR ({value: "test"}) '/> modify the attribute value </TD> </tr>
<Tr> <TD> <input type = "button" value = "testjquery" onclick = 'alert ($ ("# idkey "). val () '/> get the property value </TD> </tr>
<Tr> <TD> <input type = "button" value = "testjquery" onclick = 'alert ($ ("# idkey "). append ("123123") '/> Get attribute values </TD> </tr>
<Tr> <TD> <input type = "button" value = "testjquery" onclick = 'aonclick () '/> event </TD> </tr>
<Tr> <TD> <input type = "button" value = "testajaxjquery" onclick = 'ajaxloading () '/> ajaxloading event <Div id = "div1"> loading </div> </TD> </tr>
<Tr> <TD> <input type = "button" value = "testajaxpostjquery" onclick = 'ajaxpost () '/> testajaxpostjquery event <Div id = "div2"> loading </div> </TD> </tr>
<Tr> <TD> <input type = "button" value = "ajaxget" onclick = 'ajaxget () '/> ajaxget event <Div id = "status"> loading </div> </TD> </tr>
</Table>
</Form>
</Body>
<SCRIPT type = "text/JavaScript" charset = "gb2312">
// Function aonclick ()
//{
// $ (Document). Ready (function (){
$ ("# Idbutton "). click (function () {alert ($ ("# idbutton "). val () + "add function") ;}); // Add event
//}
VaR OBJ = {ID: "id1", value: "value1", ID: "ID2", value: "value2 "}
Function aonclick ()
{
// Alert ($ _ Get ["url"]);
Alert (OBJ [0]. value );
}
Function ajaxloading ()
{
('{Stats'{.load('1.html ');
Alert ("end ");
}
Function ajaxpost ()
{
$. Post ('ajax. aspx ',{
ID: 'My string ',
Number: 23
}, Function (data ){
Alert (Data + 'your data has been saved .');
});
}
Function ajaxget ()
{
// 'Xml ',
$. Ajax ({
URL: 'ajax. aspx? Id = 123 ',
Type: 'get ',
Datatype: 'text ',
Timeout: 1000,
Error: function (){
Alert ('error loading XML document ');
},
Success: function (XML ){
Alert (XML );
// Do something with XML
}
});
}