<%@ 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测试</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").html("hellworld 王德田"))' /></td></tr>
   <tr><td><input type="button" value="testJQuery" onclick='alert($("#idKey").attr({value:"test"}))' />修改属性值</td></tr>
   <tr><td><input type="button" value="testJQuery" onclick='alert($("#idKey").val())' />获取属性值</td></tr>
   <tr><td><input type="button" value="testJQuery" onclick='alert($("#idKey").append("123123"))' />获取属性值</td></tr>
   <tr><td><input type="button" value="testJQuery" onclick='aOnclick()' />事件</td></tr>
   <tr><td><input type="button" value="testAjaxJQuery" onclick='ajaxLoading()' />AjaxLoading事件<div id="Div1">loading</div></td></tr>
   <tr><td><input type="button" value="testAjaxPostJQuery" onclick='ajaxPost()' />testAjaxPostJQuery事件<div id="Div2">loading</div></td></tr>
   <tr><td><input type="button" value="ajaxGet" onclick='ajaxGet()' />ajaxGet事件<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");});//增加事件
//}
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

}

});

}

posted on 2009-04-14 14:17 sanmao 阅读(515) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜