ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
......
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
......
ÊÓƵÏÂÔصØÖ·
£º http://dwz.duqn.com/doc/dwz-ajax-develop.swf
ajax ±íµ¥Ìá½»¡¢·ÖÒ³×é¼þ
´ó¼ÒÔÚʹÓÃDWZ¿ò¼Ü¹ý³ÌÖÐÓöµ½ÎÊÌâ×î¶àµÄÒ²ÊÇajax±íµ¥Ìá½»´¦ÀíÁ÷³Ì¡¢·ÖÒ³×é¼þÎÊÌâ¡£±¾½Ì²ÄÖ÷ÒªÊǽ²½âDWZ¿ò¼Ü±íµ¥Ìá½»¡¢·ÖÒ³µÈajax½»»¥ÔÀíºÍ¹æ·¶¡£DWZÆäËü×é¼þÕâÀï²»ÔÙ½²½âÁË£¬´ó¼ÒÈ¥¿´DWZÓû§ÊֲᣬÌرðÊǵÚÒ»´ÎʹÓÃÒ»¶¨Òª¿´Óû§ÊÖ²áÖÐµÄ “³£¼ûÎÊÌâ¼°½â¾ö”¡£
ʵ¼ÊÉÏʹÓÃDWZ¿ò¼ÜÊǷdz£¼òµ¥·½±ãµÄ¡£¿ª·¢ÈËÔ±»ù±¾²»Ðè×Ô¼ºÐ´JS£¬°üÀ¨ajax±íµ¥Ìá½»¡¢·ÖÒ³×é¼þ¡£
ÐÅÏ¢ÁбíÉϲéѯºÍ·ÖÒ³¶¼ÊÇÓÃÒ»¸öpagerFormÀ´ÁÙʱ´æ²éѯÌõ¼þ¡£ÐèÒªÔÚÿ¸ö²éѯÁбíÒ³Ãæ¼Ó¸öÒþ²ØµÄpagerForm¡£
·ÖÒ³»òɾ³ýÁбíÖеÄÊý¾ÝµÈ²Ù×÷¶¼»áÖØÐÂÔØÈ뵱ǰnavTab»òdialog¡£ÔÀíºÜ¼òµ¥¾ÍÊÇDWZ¿ò¼Ü×Ô¶¯×é×°Õâ¸öpagerFormÖеIJÎÊýºóÖØÐÂÔØÈë
µ±Ç°navTab»òdialog¡£
±íµ¥Ìá½»¸ù¾Ý·þÎñÆ÷¶Ë·µ»ØµÄjson½á¹¹£¬ÓÐÒÔϼ¸ÖÖ´¦ÀíÁ÷³Ì£º
1) statusCode==300±íʾ²Ù×÷ʧ°Ü£¬ÌáʾÓû§³ö´íÔÒòmessage
2)
statusCode==200±íʾ²Ù×÷³É¹¦£¬Ìáʾmessage
navTabId·Ç¿Õ£¬ÖØÐÂÔØÈëÖ¸¶¨µÄnavTab
callbackType=="closeCurrent"¹Ø±Õµ±Ç°formËùÔÚµÄnab ......
ÕâÁ½Ìì¸Õ½â¾öÁËajax¶àä¯ÀÀÆ÷¼æÈݵÄÎÊÌ⣬Ö÷Òª¾ÍÕë¶ÔFirefoxµÄ£¬¿ªÊ¼»¹ÒÔΪFirefox²»Ö§³ÖajaxÄØ£¨±ðЦÎÒѽ£¬²»ÔõôÁ˽âFirefoxҲûÓùý£¬ºÇºÇ£©£¬¶à¿÷¿´ÁËÏÂÃæµÄÎÄÕ²ÅÈÃÎÒÁ˽âajaxµÄÊÊÓ÷¶Î§¡£ÆäʵֻҪ·ûºÏw3cµÄ±ê×¼¾Í¿ÉÒÔÔÚFirefoxµÈÕâЩä¯ÀÀÆ÷ÉÏÕý³£ÏÔʾ£¬ËùÒÔ»¹ÊÇÓ¦¸ÃºÃºÃÁ˽âÒ»ÏÂw3cµÄ±ê×¼¹æÔòѽ¡£²»¹ýÒª½â¾öÑÛÇ°µÄ¼æÈÝÎÊÌâÊ×ÏÈ×¢ÒâÒÔϼ¸µã£º£¨Õâ¸öÒ²ÊÇÍøÉÏÕÒÀ´µÄ£©1,document.getElementByIdÌæ´údocument.all£¨ieÊÊÓã©
2,¼¯ºÏ[]Ìæ´ú()£¨ieÊÊÓã©
3,targetÌæ´úsrcElement;parentNodeÌæ´úparentElement£¨parentNode ieÊÊÓã©
4,node.parentNode.removeChild(node)Ìæ´úremoveNode(this)£¨ieÊÊÓã©
5,DOMMouseScrollÌæ´úonmousewheel;-e.detailÌæ´úevent.wheelDelta
6,addEventListenerÌæ´úattachEvent;removeEventListenerÌæ´údetachEvent
7e.preventDefault()Ìæ´úevent.returnValue=false;e.stopPropagation()Ìæ´úevent.cancelBubble=true
8,style.top¡¢style.leftµÈÑϸñ¼ì²é"px"µ¥Î»£¨¼Ó"px" ieÊÊÓã©
9,style="-moz-opacity:0.9"Ìæ´ústyle="filter:alpha(opacity=90)";ÎÞÆäËüfilter
10,style.cursor="pointer"Ìæ´ústyle.cursor="hand"£¨ieÊÊÓã© ......
ÃèÊö:Ajax»ù´¡ ÔÚ½øÐÐAjax¿ª·¢ÒÔÇ°£¬ÎÒÃDZØÐëÏȶÔһЩ»ù±¾µÄ֪ʶ½øÐÐÁ˽⡣ËäÈ»Ajax.NETÒѾ½«AjaxʵÏÖϸ½Ú·â×°ÆðÀ´£¬²¢´ó´ó¼ò»¯
Ajax»ù´¡
ÔÚ ½øÐÐAjax¿ª·¢ÒÔÇ°£¬ÎÒÃDZØÐëÏȶÔһЩ»ù±¾µÄ֪ʶ½øÐÐÁ˽⡣ËäÈ»Ajax.NETÒѾ½«AjaxʵÏÖϸ½Ú·â×°ÆðÀ´£¬²¢´ó´ó¼ò»¯ÁËÎÒÃǵIJÙ×÷£¬µ«ÊÇÁ˽â»ù ±¾µÄAjaxʵÏÖ·½Ê½¶ÔÓÚ°ïÖúÎÒÃÇÔÚ¿ª·¢ÖÐÄܸüºÃÀí½âºÍʵʩ£¬ÒÔ¼°¸üÓÐЧµØÓÅ»¯ºÍÅÅ´íÊÇÖÁ¹ØÖØÒªµÄ¡£´ËÍ⣬ËäÈ»ÎÒÃDz»±Ø±àд¾ßÌåµÄAjaxµ÷ÓôúÀí£¬µ«ÊÇ ÔÚµ÷ÓôúÀíÇ°»ñÈ¡Êý¾Ý£¬ÒÔ¼°·µ»ØÊý¾ÝºóÔõÑùʹÊý¾ÝÄܹ»ÕýÈ·ÏÔʾ£¬ÕâÁ½²¿·Ö¹¤×÷¶¼ÐèÒªÎÒÃǾßÓлù±¾µÄJavaScript²Ù×÷DOMÄ£Ð͵ÄÄÜÁ¦¡£½ÓÏÂÀ´ÎÒÃÇ ½«À´¶ÔÕ⼸·½ÃæµÄ֪ʶ½øÐÐÌÖÂÛ¡£
5.2.1 XMLHttpRequest¶ÔÏó
¶Ô ÓÚAjax¼¼ÊõµÄ»ù´¡ºÍºËÐÄ£¬XMLHttpRequest¶ÔÏóÓ¦¸ÃÊÇÎÒÃDZØÐëÒªÁ˽âµÄÒ»¸ö¶ÔÏó£¬AjaxʵÏֵĹؼü·¢ËÍÒì²½ÇëÇó²¢½ÓÊÕÏìÓ¦Ö´Ðлص÷¶¼ÊÇ Í¨¹ýËüÀ´Íê³ÉµÄ¡£XMLHttpRequest×îÔçÊÇÔÚMicrosoft Internet Explorer 5.0ÒÔActiveX×é¼þÖб»ÒýÈëµÄ£¬Ö®ºó¸÷´óä¯ÀÀÆ÷³§É̶¼ÒÔJavaScriptÄÚÖöÔÏóµÄ·½Ê½ÊµÏÖÁËXMLHttpRequest¶ÔÏó¡£ËäÈ»´ó¼Ò¶Ô ËüµÄʵÏÖ·½Ê½ÓÐËùÇø±ð£¬µ«ÊǾø´ó¶àÊýä¯ÀÀÆ÷¶¼ÌṩÁËÀàËƵÄÊôÐԺͷ½·¨£¬ÔÚʵ¼Ê½Å±¾±àд·½·¨ÉÏÇø±ð²»´ó£¬²¢ÇÒʵÏֵà ......
¡¡¡¡µ½´ËΪֹ£¬Äã¿ÉÄÜÒѾעÒâµ½£¬Ê¹ÓÃAjax±à³ÌʱÓкܶàÂ鷳ʡ£Èç¹ûÄãÒªÖ§³Ö¶à¸öä¯ÀÀÆ÷£¨ÏÖÔÚ»¹ÓÐËÖ»Ö§³ÖÒ»¸öä¯ÀÀÆ÷ÄØ£¿£©£¬ÎÞÒÉ»áÔâÓö²»¼æÈÝÎÊÌâ¡£µ¥¿´Ò»¸ö¼òµ¥µÄ¶¯×÷£¬±ÈÈç˵´´½¨XMLHttpRequest¶ÔÏóµÄÒ»¸öʵÀý£¬ÕâÐèÒªÏȽøÐÐä¯ÀÀÆ÷²âÊÔ¡£Ò»µ©¿ªÊ¼³¢ÊÔʹÓÃAjax¼¼Êõ£¬ÄãºÜ¿ì¾Í»á×¢Òâµ½Òª·´¸´µØÍê³ÉͬÑùµÄһЩÈÎÎñ¡£µ±È»£¬Äã¿ÉÒÔÊÕ¼¯Ò»Ð©³£ÓôúÂë¿â£¬ÉõÖÁ´´½¨×Ô¼ºµÄ¿ò¼Ü¡£²»¹ý£¬×öÕâ¸ö¹¤×÷֮ǰ£¬ÐèÒªÏÈÁ˽âÒ»ÏÂÏÖÔÚÒѾÓÐЩʲôÁË¡£
¡¡¡¡ÓëËùÓÐÓÅÐã¼¼ÊõÒ»Ñù£¬AjaxÒѾ´ßÉú³ö´óÁ¿¿ò¼Ü£¬ÓÐÁËÕâЩ¿ò¼Ü£¬¿ª·¢ÈËÔ±µÄÈÕ×Ӻùý¶àÁË¡£ÎÒÃÇҪǿµ÷Ò»µã£¬Ajax»¹ºÜУ¬¶øÇÒ»¹ÔÚ·¢Õ¹£¬¿ò¼ÜÁìÓòҲͬÑùÈç´Ë¡£¼¸ºõÿÌ춼ÓÐÐÂÀ´Õߣ¬Ä¿Ç°»¹¿´²»³öËÊÇ×îºóµÄÓ®¼Ò¡£2003Äê6ÔÂ֮ǰ£¬Õâ·½ÃæµÄ¿ò¼Ü»¹²»¶à£¬ËùÒÔÔÚÒÔºóµÄ¼¸¸öÔ¿ÉÄÜ»¹»áÓо޴ó±ä»¯¡£
¡¡¡¡ÓÐЩ¿ò¼Ü»ùÓÚ¿Í»§¶Ë£¬ÓÐЩ»ùÓÚ·þÎñÆ÷¶Ë£»ÓÐЩרÃÅΪÌض¨ÓïÑÔÉè¼Æ£¬ÁíÍâһЩÔòÓëÓïÑÔÎ޹ء£ÆäÖоø´ó¶àÊý¶¼ÓпªÔ´ÊµÏÖ£¬µ«Ò²ÓÐÉÙÊýÊÇרÓõġ£ÎÒÃDz»»áÃæÃæ¾ãµ½µØ̸µ½Ã¿Ò»¸ö¿ò¼Ü£¬¶øÇÒÒ²²»¿ÉÄÜÉîÈë·ÖÎöÌáµ½µÄÿ¸ö¿ò¼Ü¡£ÎÒÃǵijö·¢µãºÜÃ÷È·£¬¾ÍÊÇÈÃÄã¶ÔÏÖÔÚÓÐЩʲôÓÐËùÈÏʶ¡£ÔÚÄã¶Áµ½±¾¸½Â¼Ê±£¬ÎÒÃÇÌáµ½µÄһЩ¹¤¾ß°ü¿ÉÄÜÒѾÏúÉùÄä¼££¬ÁíÍâµÄÔò¿ÉÄ ......
A.aspxÒ³Ãæ·ÅÒ»¸ödropdownlist£¬ÔÚA.aspx.csÌí¼Ó£º this.drpSchool.Attributes.Add("onchange", "load(this.options[this.selectedIndex].value)");
ÔÚA.aspxÒ³ÃæÌí¼ÓÈçϽű¾£º
function load(state){
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
oHttpReq.open("POST", "../B.aspx?state="+state, false);
oHttpReq.send("");
result = oHttpReq.responseText;
oDoc.loadXML(result);
items1 = oDoc.selectNodes("//NewDataSet/Table/dtid");
items2 = oDoc.selectNodes("//NewDataSet/Table/dtname");
var itemsLength=items1.length;
¡¡¡¡for(i=0;i<itemsLength;i++)
//½«Ð¡ÀàµÄÀàÃûºÍ±àºÅ¸³ÓèDropDownList2
¡¡¡¡{
¡¡
¡¡¡¡var newOption = document.createElement("OPTION");
¡¡¡¡newOption.text=items2[i].text;
¡¡¡¡newOption.value=items1[i].text;
¡¡¡¡drp2.options.add(newOption);
¡¡¡¡//¡¡newOption.value=6;
¡¡
¡¡¡¡}
}
B.aspx.csÒ³Ã棺
if (Request.QueryString["state"] != null && Request.QueryString["state"].ToString() != "")
&n ......