AJAX¡¢DOM£¬Ãû´Ê½âÊÍ
£¨ÒÔÏÂÀ´×ÔWIKI£©
AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÒ»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£¸ù據AjaxÌá³öÕßJesse James Garrett½¨議[1]£¬Ëü£º
ʹÓÃXHTML+CSSÀ´±íʾÐÅÏ¢£»
ʹÓÃJavaScript²Ù×÷DOM£¨Document Object Model£©½øÐж¯Ì¬ÏÔʾ¼°½»»¥£»
ʹÓÃXMLºÍXSLT½øÐÐÊý¾Ý½»»»¼°Ïà¹Ø²Ù×÷£»
ʹÓÃXMLHttpRequest¶ÔÏóÓëWeb·þÎñÆ÷½øÐÐÒì²½Êý¾Ý½»»»£»
ʹÓÃJavaScript½«ËùÓеĶ«Î÷°ó¶¨ÔÚÒ»Æð¡£
ʹÓÃSOAPÒÔXMLµÄ¸ñʽÀ´´«ËÍ·½·¨ÃûºÍ·½·¨²ÎÊý¡£
ÀàËÆÓÚDHTML»òLAMP£¬AJAX²»ÊÇÖ¸Ò»ÖÖµ¥Ò»µÄ¼¼Êõ£¬¶øÊÇÓлúµØÀûÓÃÁËһϵÁÐÏà¹ØµÄ¼¼Êõ¡£ÊÂʵÉÏ£¬Ò»Ð©»ùÓÚAJAXµÄ“ÅÉÉú£¯ºÏ³É”ʽ£¨derivative/composite£©µÄ¼¼ÊõÕýÔÚ³öÏÖ£¬Èç“AFLAX”¡£
AJAXµÄÓ¦ÓÃʹÓÃÖ§³ÖÒÔÉϼ¼ÊõµÄWebä¯ÀÀÆ÷×÷ΪÔËÐÐƽ̨¡£ÕâЩä¯ÀÀÆ÷Ä¿Ç°°üÀ¨£ºInternet Explorer¡¢Mozilla¡¢Firefox¡¢Opera¡¢Konqueror¼°Mac OSµÄSafari¡£µ«ÊÇOpera²»Ö§³ÖXSL¸ñʽ¶ÔÏó£¬Ò²²»Ö§³ÖXSLT[2]¡£
´«Í³µÄWebÓ¦ÓÃÔÊÐíÓû§¶ËÌîд±íµ¥£¨form£©£¬µ±Ëͳö±íµ¥Ê±¾ÍÏòWebËÅ·þÆ÷·¢ËÍÒ»¸öÇëÇó¡£ËÅ·þÆ÷½ÓÊÕ²¢´¦Àí´«À´µÄ±íµ¥£¬È»ºóËÍ»ØÒ»¸öеÄÍøÒ³£¬µ«Õâ¸ö×ö·¨ÀË·ÑÁËÐí¶à´ø¿í£¬ÒòΪÔÚÇ°ºóÁ½¸öÒ³ÃæÖеĴ󲿷ÖHTMLÂëÍùÍùÊÇÏàͬµÄ¡£ÓÉÓÚÿ´ÎÓ¦Óõŵͨ¶¼ÐèÒªÏòËÅ·þÆ÷·¢ËÍÇëÇó£¬Ó¦ÓõĻØ應ʱ¼ä¾ÍÒÀÀµÓÚËÅ·þÆ÷µÄ»Ø應ʱ¼ä¡£Õâµ¼ÖÂÁËÓû§½çÃæµÄ»Ø應±È±¾機Ó¦ÓÃÂýµÃ¶à¡£
Óë´Ë²»Í¬£¬AJAXÓ¦ÓÿÉÒÔ½öÏòËÅ·þÆ÷·¢ËͲ¢È¡»Ø±ØÐèµÄÊý¾Ý£¬ËüʹÓÃSOAP»òÆäËüһЩ»ùÓÚXMLµÄÒ³Ãæ·þÎñ½Ó¿Ú£¨½éÃ棩£¬²¢ÔÚ¿Í»§¶Ë²ÉÓÃJavaScript´¦ÀíÀ´×ÔËÅ·þÆ÷µÄ»Ø應¡£ÒòΪÔÚËÅ·þÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä½»»»µÄÊý¾Ý´óÁ¿¼õÉÙ£¨´óÔ¼Ö»ÓÐÔÀ´µÄ5%£©£¬½á¹ûÎÒÃǾÍÄÜ¿´µ½»Ø應£¨ËÅ·þÆ÷»Ø應£©¸ü¿ìµÄÓ¦Óã¨結¹û£©¡£Í¬Ê±ºÜ¶àµÄ´¦Àí¹¤×÷¿ÉÒÔÔÚ·¢³öÇëÇóµÄ¿Í»§¶Ë»úÆ÷ÉÏÍê³É£¬ËùÒÔWebËÅ·þÆ÷µÄ´¦Àíʱ¼äÒ²¼õÉÙÁË¡£
(ÒÔÏÂת×Ôhttp://www.w3school.com.cn/htmldom/htmldom_reference.asp)
JavaScript ¶ÔÏó
µã»÷ÒÔÏÂÁ´½Ó£¬¿ÉÒÔ»ñµÃÒÔ϶ÔÏóµÄ¸ü¶àÐÅÏ¢£¬°üÀ¨ËüÃǵļ¯ºÏ¡¢ÊôÐÔ¡¢·½·¨ÒÔ¼°Ê¼þ¡£ÆäÖаüº¬´óÁ¿ÊµÀý£¡
¶ÔÏóÃèÊö
Window
JavaScript ²ã¼¶ÖеĶ¥²ã¶ÔÏ󣬱íʾä¯ÀÀÆ÷´°¿Ú¡£
Navigator
°üº¬¿Í»§¶Ëä¯ÀÀÆ÷µÄÐÅÏ¢¡£
Screen
°üº¬¿Í»§¶ËÏÔʾÆÁµÄÐÅÏ¢¡£
History
Ïà¹ØÎĵµ£º
<script type="text/javascript">
function AjaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
& ......
1¡¢XMLHttpRequest¶ÔÏóµÄ´´½¨
ÓÉÓÚ ²»ÊÇw3c±ê×¼£¬ËùÒÔʹÓÃJavascript´´½¨Ö®µÄ·½·¨Ò²²»Í¬£¡Internet explorer °ÑXMLHttpRequestʵÀý»¯Îª ActiveX¿Ø¼þ£¬È»¶ø ÆäËûµÄä¯ÀÀÆ÷£¨FireFox£¬opera£©°ÑXMLHttpRequestʵÀý»¯Îª±¾µØµÄJavaScriptÒ»¸ö¶ÔÏó
ËùÒÔ Ö»ÒªÈ·¶¨ÊÇ·ñ Ö§³Ö ActiveX¿Ø¼þ¶ÔÏ󣡣¡È ......
[list=1]
ÎÒÃÇÔÚ×öÑéÖ¤ÂëµÄʱºòÍùÍùÓÉÓÚÒª·´×÷±×£¬ÑéÖ¤ÓÐʱ¹ÊÒâ¼ÓÈë¶àµÄ¸ÉÈÅÒòËØ£¬ÕâʱÑéÖ¤ÂëÏÔʾ²»ºÜÇå³þ£¬Óû§¾³£ÊäÈë´íÎó¡£ÕâÑù²»µ«ÒªÖØÐÂË¢ÐÂÒ³Ã棬µ¼ÖÂÓû§Ã»Óп´Çå³þÑéÖ¤Âë¶øÖØÌî¶ø²»ÊÇÐ޸ģ¬¶øÇÒÈç¹ûûÓÐÓÃsession±£´æÏÂÓû§ÊäÈëµÄÆäËüÊý¾ÝµÄ»°(ÈçÐÕÃû)£¬Óû§¸Õ¸ÕÊäÈëµÄÄÚÈÝÒ²²»´æÔÚÁË£¬ÕâÑù¸øÓû§Ôì³É²»ºÃµÄÌåÑé ......
index.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AJAX ¼¼Êõ¼òµ¥Ó¦ÓÃ</title>
  ......
ÈçºÎ¿ª·¢°²È«µÄAJAXÓ¦ÓÃ
AJAX¼¼ÊõÒѾÊÇÏÖÔÚ×îÁ÷ÐеÄWebÓ¦Óÿª·¢¼¼ÊõÁË£¬µ«ÊÇÓë´Ëͬʱ£¬WebÓ¦ÓÃÒ²³ÉÁËÕâ¸öIT¼Ü¹¹Öа²È«×Èõ£¬×îÈÝÒ×Êܵ½¹¥»÷µÄ²¿·Ö£¬AJAXÓ¦ÓÃÏà±È½ÏÓ봫ͳµÄWebÓ¦Ó㬴ó´óÔö¼ÓÁË¿Í»§¶ËÓë·þÎñÆ÷Ö®¼äµÄ½»»¥£¬Í¬Ê±Ò²Ê¹µÃһЩºǫ́µÄÒµÎñÂß¼½Ó¿Ú±©Â¶¸øÁË¿Í»§¶Ë£¬Èç¹û·þÎñÆ÷¶ËûÓÐ×ã¹»µÄ±£»¤»òÕßûÓжԿͻ§¶ËÇ ......