ajax³£¼ûÎÊÌâ×ܽá
ÔÚ¿´ÎÄÕÂÇ°£¬ÏÈÖ¸¶¨Ò»¸öͨÓõıäÁ¿xhr£¬xhr´úÂëajax¶ÔÏó¡£
²âÊÔä¯ÀÀÆ÷£ºieΪie6£¬firefoxΪ2£¬ÆäËûµÄδ²âÊÔ¡£Í³³Æie6Ϊie£¬firefox2Ϊff¡£
»ù±¾µÄ
1£¬×î¾µäµÄ¾ÍÊÇieϵĻº´æÎÊÌâÁË¡£
Èç¹ûʹÓõÄÊÇget£¬ÄÇôÔÚieϳöÏÖ»º´æÎÊÌâ¡£µ¼Ö´úÂëÖ»Ö´ÐÐÒ»´Î¡£½â¾ö°ì·¨¾ÍÊǼÓʱ¼ä´Á»òÕßËæ»úÊý£¬Ê¹url±äΪΨһ£¬ÕâÑù¾Í²»»á³öÏÖieϵĻº´æÎÊÌâÁË£¬»òÕ߸ÄΪpostÌá½»¡£
xhr.open("get","xxxx.aspx?_dc="+new Date().getTime(),true);
2£¬ajax¶ÔÏóÊôÐԵĴóСдÎÊÌâ
ÔÚw3cä¯ÀÀÆ÷£¬ÈçffÖУ¬¶Ô´óСдÊÇÃô¸Ð¡£Èç
if(xhr.readystate==4)ÕâÖÖд·¨£¬ÔÚieÏÂÊdzÉÁ¢µÄ£¬µ«ÊÇÔÚffϾÍÐв»Í¨ÁË£¬ÒòΪie²»Çø·Ö´óСд£¬ffÊÇÇø·Ö´óСµÄ¡£
±ê׼д·¨Îªif(xhr.readyState==4)£¬Í¬Àí»¹ÓÐÊôÐÔ responseText£¬responseXML¡£
3£¬ajax״̬0ÎÊÌâ
ÓРЩʱºòÔÚ²âÊÔajax´úÂëµÄʱºò£¬¼ÓÁË xhr.status==200µÄÅжϺó£¬Ò»Ö±²»Ö´ÐÐxhr.status==200µÄ´úÂ룬Õâ¸ö¾ÍÐèҪעÒâÁË¡£xhr.status==200ÊÇҪͨ¹ý ·þÎñÆ÷À´ä¯ÀÀ£¬²¢ÇÒ·þÎñÆ÷Ò³ÃæûÓз¢Éú´íÎó»òÕßתÏòʱ²Å·µ»Ø200״̬µÄ£¬´Ë״̬ºÍÄãͨ¹ýä¯ÀÀÆ÷·ÃÎÊÒ³Ãæʱ·þÎñÆ÷¶¨ÒåµÄ״̬һÖ¡£
Ö±½ÓÍϽøä¯ÀÀÆ÷ä¯ÀÀ½á¹û»òÕßË«»÷ÔËÐÐhtmlÒ³ÃæµÄ£¬Î´·¢Éú´íÎóʱ£¬´ËʱµÄxhr.statusÊÇ0£¬²»ÊÇ200¡£
ËùÒÔ¿ÉÒÔ¶à¼ÓÒ»¸öxhr.status==0µÄÅжϡ£ÈçÏÂ
if(xhr.status==200||xhr.status==0){ alert('ok');}
Ö±½ÓÍϽøä¯ÀÀÆ÷ä¯ÀÀ½á¹û»òÕßË«»÷ÔËÐÐhtmlÒ³Ãæʱ£¬ÓÖ³öÏÖÒ»¸öÎÊÌ⣬Èç¹ûÇëÇóµÄÊÇxmlÎļþ£¬ÄÇÏ뵱ȻµÄÊÇʹÓÃresponseXMLÊôÐÔ·µ»ØxmlDomÁË£¬µ«ÊÇÔÚie·µ»Ø²»ÁËxmlDomÊôÐÔ£¬½â¾ö°ì·¨ÈçºÎÄØ£¬¿´ÏÂÃæµÄresponseXMLÎÊÌâ¡£
4£¬responseXMLÎÊÌâ¡£
ҪʹÓÃresponseXMLÊôÐÔ£¬ÇëÇóµÄÊÇxmlÎļþ»òÕßÉèÖÃÁËÏìӦͷΪ"text/xml"µÄ¶¯Ì¬Ò³ÃæÁË¡£Òª×¢ÒâÈç¹ûÇëÇóµÄÊǶ¯Ì¬Ò³Ã棬һ¶¨²»ÒªÍü¼ÇÉèÖÃcontenttypeΪ"text/xml"£¡£¡£¡£¡£¡£¡£¡£¡ÇмÇ~~~~~~
aspΪ response.contenttype="text/html"
asp.netΪ Response.ContentType="text/html";
phpΪ header("content-type:text/xml;");
ÔÚieÏÂÓиöÎÊÌ⣬ֱ½ÓÍϽøä¯ÀÀÆ÷ä¯ÀÀ»òÕßË«»÷ÔËÐÐhtmlÔ¤ÀÀЧ¹ûʱ£¬ÇëÇóµÄ¼´Ê¹ÊÇxmlÎļþ£¬Ê¹ÓÃresponseXML·µ»Ø²»ÁËxmldom¡£
´ó¼Ò²âÊÔϾÍÖªµÀÁË£¬ÈçÏÂ
showbo.xml
<?xml version="1.0" encoding="utf-8"?><showbo> <item>1</item> <item>2&
Ïà¹ØÎĵµ£º
Ò»¡¢¸ÅÊö
Marquee£ºHtmlÖйöÆÁ¿Ø¼þ£¬¿ÉÒÔʹ°üº¬Ôڴ˱ê¼ÇÖеÄÄÚÈݽøÐи÷¸ö·½Ïò£¬¸÷ÖÖËٶȵĹö¶¯£¬Òò´ËÔÚ²»¿¼ÂÇʹÓõÚÈý·½¿Ø¼þµÄÇ°ÌáÏ£¬¿¼ÂÇʹÓÃMarquee+xmlhttpÀ´ÊµÏÖ¶¨´Î¸üÐÂÒ³ÃæÖеĹö¶¯ÄÚÈÝ£¬´ËʵÏÖÔÚIE6.0¼°ÒÔÉÏ°æ±¾²âÊÔͨ¹ý£¬ÆäËûä¯ÀÀÆ÷ÔÝʱδ²âÊÔ¹ý¡£
MarqueeÖеÄonfinishʼþ£ºÔÚ¸øMarqueeÊôÐÔloop¸ ......
20 ¸ö¾µäµÄ Ajax + CSS ±í¸ñ
²¢²»ÊÇËùÓеÄWeb ¿ª·¢Õ߶¼»á¶ÔÃÀ»¯±í¸ñÊý¾Ý¸ÐÐËȤ£¬½ñÌìÎÒÃÇÊÕ¼¯ÁË20 ¸ö¹¦ÄÜÇ¿´ó£¬Íâ¹ÛƯÁÁµÄ»ùÓÚAjax + CSS µÄ±í¸ñЧ¹û£¬Äã¿ÉÒÔ´ÓÕâЩʾÀýÖÐѧϰÔõôʹÓÃÕâЩ±í¸ñÌṩµÄÅÅÐòºÍ¹ýÂ˵ŦÄÜÀ´×éÖ¯±í¸ñÖеÄÊý¾Ý¡£
ÏÖÔÚÈÃÎÒÃÇÀ´¿´¿´ÕâЩ±í¸ñ£º£¨µã»÷ÿ¸öÑùʽǰÃæµÄÁ´½Ó¼´¿É½øÈëÏÂÔØ£©
¡¡¡¡#1. ......
IDE£ºVisual Web Developer 2008 Express Edition
Êý¾Ý¿â£ºAccess 2007
µ½http://www.asp.net/ajax/downloads/ÏÂÔØAJAX Control Toolkit£¬½«AjaxControlToolkit.dll¿½±´µ½ÏîÄ¿µÄbinĿ¼Ï£¬ÔÚ¹¤¾ßÀ¸ÖÐÒýÈë¡£
WebServiceµÄ´úÂ룺£¨aaa.asmx£©
Public Function GetCompletionList(ByVal prefixText As String, ByVal coun ......
function createXMLHttpRequest(){
if(window.ActiveXObject){
http = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
& ......
ÉÏÃæһƪ²©ÎÄ<<Ajax·ÃÎÊXml Web ServiceµÄ°²È«ÎÊÌâÒÔ¼°½â¾ö·½°¸>>ÖÐ̸¼°xml web serviceÓëwcfÐÂÀϼܹ¹¶ÔÓÚajax°²È«ÐÔµÄÎÊÌâ,µÃ³öÁ˽áÂÛ,µ«Ã»ÓоßÌåÑéÖ¤,±¾ÎÄÕýÊÇΪÁËÑéÖ¤ÉÏÎÄÖйØÓÚмܹ¹MEX½áµãÓëÒµÎñÖÕ½áµã·ÖÀë¸üÓÐÀûÓÚ·þÎñ°²È«µÄ½áÂÛ,²¢ÉÔ´ø׎²ÊöÈçºÎÔÚvs2008ÖÐÓÃajaxÓëwcf½øÐн»»¥.
µÚÒ»²½: ÔÚvs2008ÖÐ ......