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

Ajax»ù´¡½Ì³Ì

 Ajax ÓÉ HTML¡¢JavaScript™ ¼¼Êõ¡¢DHTML ºÍ DOM ×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ Web ½çÃæת»¯³É½»»¥Ð﵀ Ajax Ó¦ÓóÌÐò¡£¶ÔÓÚAjax£¬×îºËÐĵÄÒ»¸ö¶ÔÏóÊÇXMLHttpRequest£¬ËùÓеÄAjax²Ù×÷¶¼Àë²»¿ª¶ÔÕâ¸ö¶ÔÏóµÄ²Ù×÷¡£
Ê×ÏÈÎÒÃÇÀ´Á˽âÔõôÔÚjavascriptÖд´½¨Õâ¸ö¶ÔÏó£º
var xmlHttp = new XMLHttpRequest();
ÕâÐмòµ¥µÄ´úÂëÔÚ Mozilla¡¢Firefox¡¢Safari¡¢Opera ÒÔ¼°»ù±¾ÉÏËùÓÐÒÔÈκÎÐÎʽ»ò·½Ê½Ö§³Ö Ajax µÄ·Ç Microsoft ä¯ÀÀÆ÷ÖУ¬´´½¨ÁË XMLHttpRequest ¶ÔÏó¡£µ«ÊǶÔÓÚÊг¡Õ¼ÓÐÂÊ´ïµ½70%µÄIEÀ´Ëµ£¬ÕâÖÖ·½·¨ÊDz»Ðеģ¬¶ø²»Í¬µÄIE°æ±¾»¹Óв»Í¬µÄ´´½¨·½·¨£¬ËùÒÔÎÒÃÇÐèÒªÔÚIEÏÂÃæʹÓÃÏÂÃæÁ½ÖÖ´´½¨¶ÔÏóµÄ°ì·¨£º
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");//Õë¶Ô½ÏеÄä¯ÀÀÆ÷
} catch (err) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//Õë¶Ô½ÏÀϵÄä¯ÀÀÆ÷
} catch (err2) {
xmlHttp = false;
}
}
¼´Ê¹ÕâÑù£¬ÎÒÃÇÒ²ÎÞ·¨Ô¤ÁÏÓÐЩä¯ÀÀÆ÷¿ÉÄÜÎÞ·¨´´½¨Õâ¸ö¶ÔÏó£¬ËùÒÔÔÚ´´½¨²»³É¹¦µÄÇé¿öÏ£¬ÎÒÃÇ»¹Òª¼ÓÉÏÒ»¾ä£º
if (!xmlHttp){
alert("ÎÞ·¨´´½¨ XMLHttpRequest ¶ÔÏó£¡");
}
½áºÏÆðÀ´¾ÍÊÇ£º
var xmlHttp = false;
try {
xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
xmlHttp = false;
}
}
}
if (!xmlHttp){
alert("ÎÞ·¨´´½¨ XMLHttpRequest ¶ÔÏó£¡");
}
È»ºó£¬ÈÃÎÒÃǽ¨Á¢Ò»¸öº¯ÊýgetInfo()£¬´ò¿ªÒì²½ÇëÇó£º
function getInfo() {
var num = document.getElementById("num").value;//»ñµÃ±íµ¥µÄÊý¾Ý
var url = "/ajax/1.php?n=" + escape(num);
xmlHttp.open("GET", url, true);//ÕâÀïµÄtrue´ú±íÊÇÒì²½ÇëÇó
}
Ò»µ©Óàopen() ÅäÖúÃÖ®ºó£¬¾Í¿ÉÒÔ·¢ËÍÇëÇóÁË¡£ËäÈ»¿ÉÒÔʹÓàsend() ·¢ËÍÊý¾Ý£¬µ«Ò²ÄÜͨ¹ý URL ±¾Éí·¢ËÍÊý¾Ý¡£ÊÂʵÉÏ£¬Ôڴ󲿷ÖGET&nb


Ïà¹ØÎĵµ£º

AjaxÌØЧ ¶¯Ì¬Ê÷ÐÎÁбí Ö®¶þ

¼¼ÊõÒªµã
ÔÚ»ù±¾Ô­ÀíµÄ½éÉÜÖУ¬Á˽⵽ͨ¹ýÔÚ¸¸½ÚµãÄÚ¶¯Ì¬´´½¨×ӽڵ㣬²¢ÀûÓÃÑùʽ±íËõ½øÍê³ÉÊ÷ÐÎÁбíµÄ»ù±¾¿ò¼Ü¡£³ýÁËÕâÒ»µãÍ⣬»¹ÓÐÏÂÃæһЩÎÊÌâÐèÒª¿¼ÂÇ¡£
1£®½«¸¸½ÚµãËùÓеÄ×Ó½Úµã·ÅÈëÒ»¸öÈÝÆ÷ÖÐ
»ù±¾Ô­ÀíÒ³ÃæÖнö°üº¬ÁË´´½¨×Ó½ÚµãµÄ¹¦ÄÜ£¬²»¿ÉÒÔ½«´´½¨ºÃµÄ½ÚµãÔÙ½øÐйرղÙ×÷¡£Êµ¼ÊÓ¦ÓÃÖв˵¥×ÜÊÇ°üº¬´ò¿ªºÍ¹Ø±ÕÁ½ÖÖ² ......

AjaxÌØЧ ¶¯Ì¬Ê÷ÐÎÁбí Ö®Èý

Êý¾Ý¿âÉè¼Æ
±¾ÊµÀýʹÓÃÃûΪtreeµÄÊý¾Ý¿â±í£¬°üº¬µÄÊý¾ÝÈçͼ1.8Ëùʾ£¬¾ßÌåµÄ½¨±íÓï¾äÈçÏ£º
CREATE TABLE 'tree' (
  'id' int(11) NOT NULL auto_increment,
  'text' varchar(255) NOT NULL,
  'isfolder' varchar(5) NOT NULL default 'false',
  'link' varchar(255) default NULL,
  ' ......

²»ÓÃAJAXʵÏÖǰ̨JSµ÷Óúǫ́C#·½·¨(С¼¼ÇÉ)

      £¨×ªÌû£©
¡¡¡¡Ò»Ìáµ½ÈçºÎÔÚǰ̨JSµ÷Óúǫ́C#·½·¨£¬AJAX³ÉΪÁ˱ØÈ»µÄÏë·¨¡£
¡¡¡¡Ö»ÊÇʵÏÖµÄϸ½Ú²ÉÓÃAJAX 1.0»òÕßAjaxProµÄÇø±ð¡£
¡¡¡¡ÆäʵÈç¹û²»ÓÃAJAX£¬ÎÒÃÇÒ²Äܹ»ºÜ·½±ãµØÀûÓÃJSµ÷Óúǫ́·½·¨¡£
¡¡¡¡²½ÖèÈçÏ£º
¡¡¡¡1 ǰ̨·ÅÒ»¸ö°´Å¥¡£ÉèÖÃΪÒþ²Ø¡£×¢Ò⣺²»ÄÜÖ±½ÓÉèÖÃVisible=falseµÄ· ......

AJAX¿ò¼Ü

HTML source:
<p>
Name:
<input type="text" id="demoName"/>
<input value="Send" type="button" onclick="update()"/>
<br/>
Reply: <span id="demoReply"></span>
</p>
Javascript source:
var services = new dojox.rpc.Service({
target:"../dwr/j ......

Ò»¸ö¼òµ¥µÄajaxÇëÇóÀý×Ó

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript&quo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ