Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

´«ÖDz¥¿ÍAjaxÊÓƵºó¼¯ÊÓƵËæ±Ê

 ===============ÏÂÆ­Ajax
================
ʮһ¡¢µÚʮһ¿Î   ===¡· ʹÓÃXHR¶ÔÏó·¢ËͺͽÓÊÜÊý¾Ý
a.¼ÌÐøÉÏÃæ²½Öè
2)×¢²á»Øµ÷º¯Êý,ֻдº¯ÊýÃû³Æ(Èç¹û¼ÓÁËÀ¨ºÅ£¬ÄÇô¾Í°Ñº¯Êý·µ»ØÖµ×¢²á¸ø»Øµ÷º¯Êý)
xmlHttp.onreadystatechange = callback;
3)ÉèÖÃÁ¬½ÓÐÅÏ¢
//µÚÒ»²ÎÊýÊÇHttpÇëÇó·½Ê½£¬Ò»°ãÑ¡Ôñget¡¢post
//µÚ¶þ²ÎÊýÊÇurlµØÖ·
//µÚÈý¸ö²ÎÊý±íʾÒì²½»¹ÊÇͬ²½£¬true±íʾÒì²½
xmlHttp.open("GET", "ajaxserver?name="+userName, true);
4)·¢ËÍÊý¾Ý¡¢¿ÉÊÇÓë·þÎñÆ÷½øÐн»»¥
//ͬ²½·½Ê½Ï£¬send»áÔÚ·þÎñÆ÷Êý¾Ý»ØÀ´ºó²ÅÖ´ÐÐÍê
//Òì²½·½Ê½Ï£¬send»áÁ¢¼´Ö´ÐÐÍê
xmlHttp.send(null);
5)½ÓÊÕÏìÓ¦Êý¾Ý
function callback(){
//Åж϶ÔÏó״̬½»»¥Íê³É
if (xmlHttp.readyState == 4){ 
//ÅжÏhttp½»»¥ÊÇ·ñ³É¹¦£¬http״̬Âë200
if(xmlHttp.status == 200){
//»ñµÃ·þÎñÆ÷·µ»ØµÄ´¿Îı¾Êý¾Ý
var responseText = xmlHttp.responseText;
//ÏÔʾµ½½çÃæ
document.getElementById("result").innerHTML = responseText;
}
}
}
Ê®¶þ¡¢µÚÊ®¶þ¿Î   ===¡· ä¯ÀÀÆ÷Ç²âÊÔÓ빤¾ßÂþ̸
a.ûʲô¿ÉдµÄ£¬¶¼ÊÇһЩÈí¼þµÄ½éÉÜ
Ê®Èý¡¢µÚÊ®Èý¿Î   ===¡· ΪѧԱµ÷ÊÔ´íÎóÓëXHRÉîÈë½²½â
a.¾Ö²¿±äÁ¿£¬²»Äܶàдvar,statusд´í
b.Ñ¡Ôñpost·½Ê½Ìá½»Êý¾Ý
xmlHttp.open("POST", "ajaxserver", "true");
//±ØÐëÉèÖÃhttpµÄÇëÇóÍ·
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send("name=" +userName);
Ê®ËÄ¡¢µÚÊ®ËĿΠ  ===¡· ÀûÓÃXHR½ÓÊÜÓë´¦ÀíXMLÊý¾Ý
a.·þÎñÆ÷¶ËÐ޸ģ¬httpServletResponse.setContentType("text/xml;charset-utf-8");
b.¿Í»§¶ËÐ޸ģ¬var domObj = xmlHttp.responseXML;
//<message>123122</message>
//getElementsByTagName();ËùÓÐmessage½Úµã£¬·µ»ØÒ»¸öÊý×é
var mgeNodes = domObj.getElementsByTagName("message");
//»ñµÃ×ӽڵ㡢»ñµÃÎı¾ÄÚÈÝ
var textNode = mgeNodes[0].firstChild;
var responseText = textNode.nodeValue;
c.Èç¹û·þÎñÆ÷setContentType("text/html;charset-utf-8");
firefox¿ÉÒÔÈÔÈ»³öÀ´£¬¶øie²»¿ÉÒÔ
d.ajaxÓ¦ÓõÄÎå¸ö²½Öè
1)´´½¨XMLHttpRequest¶ÔÏó
2)×¢²á»Øµ÷º


Ïà¹ØÎĵµ£º

10¸ö·Ç³£°ôµÄAjax¼°JavascriptʵÀý×ÊÔ´ÍøÕ¾

1.Ajax Rain
¡¡¡¡AjaxRainÓкܶàÍêÃÀÕûºÏAJAX, CSS, DHTML »ò JavascriptµÄʵÀý£¬ÓÐһЩDemoµÄÈ·ÖµµÃÄãÈ¥¿´Ò»¿´£¬¼´Ê¹Äã²»ÊÇÍøÒ³Éè¼Æ(¿ª·¢)ʦ¡£
Ajax/JavascriptʵÀý:
 EXT JS Date Picker
 jQuery Feed Menu
 jGrowl
 FastFind Menu – Jquery
 Spiffy Accordion
2.Ajax Daddy ......

ajax»ù´¡¶ÁÊé±Ê¼Ç µÚÈýÕ£¨·¢ËÍÇëÇóÓë´¦ÀíÏìÓ¦£©

ͨ¹ýXMLHttpRequest.responseXML;
½«ÏìÓ¦½âÎöΪXML
»ñµÃ¶ÔÏóÓÐÏÂÃæµÄÊôÐԺͷ½·¨
±í3-1  ÓÃÓÚ´¦ÀíXMLÎĵµµÄDOMÔªËØÊôÐÔ
ÊôÐÔÃû
 ÃèÊö
 
childNodes
 ·µ»Øµ±Ç°ÔªËØËùÓÐ×ÓÔªËصÄÊý×é
 
firstChild
 ·µ»Øµ±Ç°ÔªËصĵÚÒ»¸öϼ¶×ÓÔªËØ
 
lastChild
 ·µ»Øµ±Ç°ÔªËصÄ×îºóÒ»¸ ......

AJAXÖе±Êó±ê»¬¹ý,ÐбäÉ«.


<style type="text/css">
<!--
.STYLE1 {
 font-size: 24px;
 font-weight: bold;
}
.STYLE2 {font-size: 36px}
-->
 .mouseOut {
    color: #000000;
 
 
  
    }
    .mouseOver {
 &nb ......

10ÖÖAJAX/JavaScriptÌØЧʵÀýÈÃÄãµÄÍøÕ¾¸üÎüÒýÈË

 ½ñÌìµÄ»°ÌâÊÇÈçºÎ¸Ä½ø×Ô¼ºÍøÕ¾µÄ½çÃæ»òÌá¸ßÍøÕ¾µÄÊÓ¾õÌåÑ飬´Ó¶øÈÃÓû§¼ÇÒäÓÌС£
¡¡¡¡ÎÒÃÇÓÐÈýÖÖÖ÷ÒªµÄ·½·¨(´ÓÄѵ½Ò×):×Ô¼º¶¯ÊÖд½Å±¾;ʹÓÃÀàËÆÓÚjQueryºÍmooToolsµÄJavaScript¿ò¼Ü(¿ÉÒÔÈñàд´úÂë±äµÃ¸üÈÝÒ×Щ);ʹÓÃÄܹ¤×÷ÓÚÏÖÓеÄJavaScript¿ò¼ÜϵÄÌáÇ°Ô¤ÖúõĽű¾»òÄÇÖÖ´ÓÍ·¿ªÊ¼¿ª·¢µÄ´´½¨Õß¡£ÕâƪÎÄÕÂÊʺÏÄÇ ......

AJAX¡¢DOM£¬Ãû´Ê½âÊÍ

£¨ÒÔÏÂÀ´×ÔWIKI£©
      AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÒ»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£¸ù據AjaxÌá³öÕßJesse James Garrett½¨議[1]£¬Ëü£º
ʹÓÃXHTML+CSSÀ´±íʾÐÅÏ¢£»
ʹÓÃJavaScript²Ù×÷DOM£¨Document Object Model£©½øÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ