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
Ïà¹ØÎĵµ£º
1.ʲôÊÇAjax?
AjaxµÄÈ«³ÆÊÇ£ºAsynchronous + JavaScript+XML --------------------> Òì²½µÄ(²»Í¬Ê±µÄ) javascript ¼° xml
2.AjaxµÄ¶¨Ò壺
Ajax²»ÊÇÒ»¸ö¼¼Êõ£¬Ëüʵ¼ÊÉÏÊǼ¸ÖÖ¼¼Êõ£¬Ã¿ÖÖ¼¼Êõ¶¼ÓÐÆä¶ÀÌØÕâ´¦£¬ºÏÔÚÒ»Æð¾Í³ÉÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄм¼Êõ¡£
3.Ajax°üÀ¨£º
XHTMLºÍCSS
ʹÓÃÎĵµ¶ ......
ajax ÔÚÄ¿Ç° web ÁìÓòÒѹ㷺ӦÓã¬ÆäÕæÕýºËÐÄÖ»²»¹ýÊÇÒ»¸ö·â×°ºÃÁ赀 js ¿â¡£×îÎ廨°ËÃŵÄĪ¹ýÓÚ asp.net µÄ¿Ø¼þ£¬ÎÒ¸öÈËÈÏΪ ajax Ö»ÊÇÒ»¸öÇáÁ¿¼¶µÄ¶«Î÷£¬¸ù±¾Ã»ÓбØÒª½«Ëüд³É·þÎñÆ÷×é¼þ£¬Èç ajax.net¡¢AjaxControlToolkit µÈ¡£ËùÒÔÎÒÒ»Ö±ÊÓÕâЩ×é¼þΪÀ¬»ø¡£¡£¡£
ÒÔÏÂ˵Ã÷ÎÒΪʲô²»ÈÏͬ ajax µÄÏà¹Ø×é¼þ£º ......
<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¿Ø¼þ¶ÔÏ󣡣¡È ......
NO1.
ÔÚatlas(ajax)ÖÐÇ벻ҪʹÓÃResponse.Write(),
ÇëʹÓÃClientScript.RegisterClientScriptBlockÌæ»»
ʹÓÃÈçÏ£º
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('×Ô¼º¿´×Å°ì!')</script>");
×¢Ò⣺RegisterStartupScript ·½·¨Êǽ« JavaScript ǶÈëµ½ ASP.NET Ò³ÃæµÄµ×²¿£ ......