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

·â×°Ò»¸ö¼òµ¥µÄAjaxº¯Êý

/**
* Ajax²Ù×÷º¯Êý
*
* @param url -- ·þÎñÆ÷¶ËÒ³ÃæµØÖ·
* @param param -- ²ÎÊý£¬ÀàËÆ 'user=123&id=100'
* @param method -- ÇëÇó·þÎñÆ÷¶ËµÄ·½·¨,GetºÍPostÁ½ÖÖ£¬Ä¬ÈÏÊÇGET
* @param response -- ÊÇ·ñ»ñÈ¡·þÎñÆ÷¶Ë·µ»ØµÄ½á¹û£¬Ä¬ÈÏÊÇtrue
*/
function ajax( url, param, method, response ){
//set default value
param = typeof(param)=='undefined' ? '' : param;
method = typeof(method)=='undefined' ? 'GET' : method;
response = typeof(response)=='undefined' ? true : response;
//get ajax object
var ajax = null;
try {
   ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
   try {
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    ajax = null;
   }
}
if (!ajax && typeof XMLHttpRequest!='undefined'){
   ajax = new XMLHttpRequest();
}
if (!ajax){
   alert("Get ajax object failed");
   return false;
}
//send http request
var res = '';
if (method != 'GET'){
   method = 'POST';
}
if (method == 'GET'){
   ajax.open('GET', url + param, true);
   ajax.onreadystatechange = function(){
    if (ajax.readyState==4 && ajax.status==200){
     res = ajax.responseText;
    }
   }
   ajax.send(null);
}
if (method == "POST"){
   ajax.open("POST", url, true);
   ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   ajax.send(param);
   ajax.onreadystatechange = function() {
    if (ajax.readyState==4 && ajax.status==200) {
     res = ajax.responseText;
    }
   }
}
if (response){
   return res;
}
return null;
}


Ïà¹ØÎĵµ£º

Ajax¿Ø¼þ

NO1.
ÔÚatlas(ajax)ÖÐÇ벻ҪʹÓÃResponse.Write(),
ÇëʹÓÃClientScript.RegisterClientScriptBlockÌæ»»
ʹÓÃÈçÏ£º
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('×Ô¼º¿´×Űì!')</script>");
×¢Ò⣺RegisterStartupScript ·½·¨Êǽ« JavaScript ǶÈëµ½ ASP.NET Ò³ÃæµÄµ×²¿£ ......

ajax ÖÐÎÄÂÒÂë

½â¾öAjax´«ËÍÖÐÎĻᵼÖÂÂÒÂëµÄÎÊÌâ
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val);   ......

×îзâ×°°¬¶÷AjaxÎÞË¢ÐÂÉÏ´«×î¼òµ¥µÄµ÷Ó÷½·¨

 ÉÏ´«Ò³ÃæÖ»ÐèÒªÒ»¸öjsÒýÓúÍjsº¯ÊýµÄµ÷Ó㬼òµ¥·½±ã£¬²»Ó°ÏìÍøÒ³Ô­Óв¼¾Ö¡£
ÏÂÔØµØÖ·
µ÷ÓÃ˵Ã÷: 
1.Ê×ÏÈÒýÓÃjsÎļþ
<script type="text/javascript" src="AienUpload/init.js"></script>
2.½«º¯Êýµ÷ÓÃ(showUpload(boxCtrl,inputCtrl,upPath,maxCount,fn);)°ó¶¨µ½HTMl¿Ø¼þʼþ£¬ÀýÈç ......

xtree dwr (ajax)Òì²½¼ÓÔØÃ¿¸öÊ÷½áµãµÄ´úÂë

 tree.js
function getRank(rankNum)
{
 var rankName="";
 switch(rankNum)
 {
  case 1:
   {
    rankName="(ÆÕͨ»áÔ±)";
    break;
   }
   case 2:
   {
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ