ʹÓà jQuery ¼ò»¯ Ajax ¿ª·¢
jQuery ÊÇÒ»¸öJavaScript ¿â£¬ËüÓÐÖúÓÚ¼ò»¯ JavaScript™ ÒÔ¼° Asynchronous JavaScript + XML (Ajax) ±à³Ì¡£ÓëÀàËÆµÄ JavaScript ¿â²»Í¬£¬jQuery ¾ßÓжÀÌصĻù±¾ÔÀí£¬¿ÉÒÔ¼ò½àµØ±íʾ³£¼ûµÄ¸´ÔÓ´úÂ롣ѧϰ jQuery »ù±¾ÔÀí£¬Ì½Ë÷ÆäÌØÐԺ͹¦ÄÜ£¬Ö´ÐÐһЩ³£¼ûµÄ Ajax ÈÎÎñ²¢ÕÆÎÕÈçºÎʹÓòå¼þÀ©Õ¹ jQuery¡£
jQuery ÊÇʲô£¿
Çë·ÃÎÊ Ajax ¼¼Êõ×ÊÔ´ÖÐÐÄ£¬ÕâÊÇÓÐ¹Ø Ajax ±à³ÌÄ£ÐÍÐÅÏ¢µÄһվʽÖÐÐÄ£¬°üÀ¨ºÜ¶àÎĵµ¡¢½Ì³Ì¡¢ÂÛ̳¡¢blog¡¢wiki ºÍÐÂÎÅ¡£ÈκΠAjax µÄÐÂÐÅÏ¢¶¼ÄÜÔÚÕâÀïÕÒµ½¡£
jQuery ÓÉ John Resig ´´½¨ÓÚ 2006 Äê³õ£¬¶ÔÓÚÈκÎʹÓà JavaScript ´úÂëµÄ³ÌÐòÔ±À´Ëµ£¬ËüÊÇÒ»¸ö·Ç³£ÓÐÓÃµÄ JavaScript ¿â¡£ÎÞÂÛÄúÊǸոսӴ¥ JavaScript ÓïÑÔ£¬²¢ÇÒÏ£Íû»ñµÃÒ»¸öÄܽâ¾öÎĵµ¶ÔÏóÄ£ÐÍ£¨Document Object Model£¬DOM£©½Å±¾ºÍ Ajax ¿ª·¢ÖÐһЩ¸´ÔÓÎÊÌâµÄ¿â£¬»¹ÊÇ×÷Ϊһ¸öÑá¾ëÁË DOM ½Å±¾ºÍ Ajax ¿ª·¢ÖÐÎÞÁĵÄÖظ´¹¤×÷µÄ×ÊÉî JavaScript ר¼Ò£¬jQuery ¶¼»áÊÇÄúµÄÊ×Ñ¡¡£
jQuery ÄÜ°ïÖúÄú±£Ö¤´úÂë¼ò½àÒ׶Á¡£ÄúÔÙÒ²²»±Ø±àд´ó¶ÑÖظ´µÄÑ»·´úÂëºÍ DOM ½Å±¾¿âµ÷ÓÃÁË¡£Ê¹Óà jQuery£¬Äú¿ÉÒÔ°ÑÎÕÎÊÌâµÄÒªµã£¬²¢Ê¹Óþ¡¿ÉÄÜ×îÉٵĴúÂëʵÏÖÄúÏëÒªµÄ¹¦ÄÜ¡£
ºÁÎÞÒÉÎÊ£¬jQuery µÄÔÀíÊǶÀÒ»ÎÞ¶þµÄ£ºËüµÄÄ¿µÄ¾ÍÊDZ£Ö¤´úÂë¼ò½à²¢¿ÉÖØÓᣵ±ÄúÀí½â²¢Ìå»áÕâÒ»ÔÀíºó£¬±ã¿ÉÒÔ¿ªÊ¼Ñ§Ï°±¾½Ì³ÌÁË£¬¿´¿´ jQuery ¶ÔÎÒÃǵıà³Ì·½Ê½ÓжàÉٸĽø°É¡£
»ØÒ³Ê×
һЩ¼òµ¥µÄ´úÂë¼ò»¯
ÏÂÃæÊÇÒ»¸ö¼òµ¥Ê¾Àý£¬Ëü˵Ã÷ÁË jQuery ¶Ô´úÂëµÄÓ°Ïì¡£ÒªÖ´ÐÐһЩÕæÕý¼òµ¥ºÍ³£¼ûµÄÈÎÎñ£¬±È·½ËµÎªÒ³ÃæµÄijһÇøÓòÖеÄÿ¸öÁ´½Ó¸½¼ÓÒ»¸öµ¥»÷£¨click£©Ê¼þ£¬Äú¿ÉÒÔʹÓô¿ JavaScript ´úÂëºÍ DOM ½Å±¾À´ÊµÏÖ£¬Èç Çåµ¥ 1 Ëùʾ¡£
Çåµ¥ 1. ûÓÐʹÓà jQuery µÄ DOM ½Å±¾
var external_links = document.getElementById('external_links');
var links = external_links.getElementsByTagName('a');
for (var i=0;i < links.length;i++) {
var link = links.item(i);
link.onclick = function() {
return confirm('You are going to visit: ' + this.href);
};
}
Çåµ¥ 2 ÏÔʾÁËʹÓà jQuery ʵÏÖµÄÏàͬµÄ¹¦ÄÜ¡£
Çåµ¥ 2. ʹÓÃÁË jQuery µÄ DOM ½Å±¾
$('#external_links a').click(function() {
return confirm('You are going to visit: ' + this.href);
});
ÊDz»ÊǺÜÉñÆ棿 ʹÓà jQuery£¬Äú¿ÉÒÔ°ÑÎÕÎÊÌâµÄÒªµã£¬Ö»ÈôúÂëʵÏÖÄúÏëÒ
Ïà¹ØÎĵµ£º
¡¡¡¡Ê×Ïȼì²éWeb.configÎļþÀïÊÇ·ñÊÇÈçÏ´úÂ룺
¡¡¡¡´ò¿ªVS2005´´½¨ÐÂÏîÄ¿£¬Ñ¡ÔñASP.NET¡¡AJAXÏîÄ¿£¬È»ºó°Ñ¸ÃÏîÄ¿Web.configÎļþµÄÄÚÈÝÈ«²¿¸´ÖƵ½Ä㱨´íµÄWeb.configÎļþÀï¡£
¡¡¡¡Èç¹ûÕâ¸ö°ì·¨Î´Äܽâ¾ö°ì·¨Çë²é¿´¸ÃÏîÄ¿¸ùĿ¼µÄBinÎļþ¼ÐÄÚÊÇ·ñÓÐSystem.Web.Extensions.Design.dll¡¢System.Web.Extensions.dll¡¢A ......
ÕªÒª
±¾ÎĽ«Ê×ÏȽéÉÜÒ»ÏÂÎÄÕµÄд×÷±³¾°ºÍÓõ½µÄÏà¹Ø¼¼Êõ¡£È»ºó½«·Ö±ðʹÓÃÆÓËصÄAjax¼¼ÊõºÍASP.NET AJAX¿ò¼Ü·Ö±ðʵÏÖ¾µäµÄ“Hello£¡XX”£¬Í¨¹ýÁ½¸öСÀý×Ó£¬Ê¹ÅóÓÑÃǶÔÕâ¸ö¿ò¼ÜµÄÌصãºÍ¿ò¼ÜµÄʹÓ÷½·¨ÓÐÒ»¸ö³õ²½µÄÈÏʶ¡£
Ç°ÑÔ
ÎÒÏ룬Èç¹û½ñÌìÄ ......
Õ⼸Ì칤×÷£¬ÓõÄÊÇAJAX¿ò¼Ü£¬½á¹ûµ¼³öExcel±í¸ñµÄʱºòÎÞ·¨µ¼³ö¡£
½â¾ö°ì·¨£º1¡¢ÔÚ.aspxÒ³ÃæÊ×ÐÐÖÐ<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JinHuoDan.aspx.cs" Inherits="out_store_JinHuoDan" %> Ìí¼ÓEnableEventValidation="false" £»
2¡¢ÔÚUPdatePanelÖÐÌí¼Ó</ContentTemplate>
......
tree.js
function getRank(rankNum)
{
var rankName="";
switch(rankNum)
{
case 1:
{
rankName="(ÆÕͨ»áÔ±)";
break;
}
case 2:
{
&n ......
ǰ̨´úÂ룺
<head runat="server">
<title>ÎÞ±êÌâÒ³</title>
<script src="Ajax.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div&g ......