Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : ajax

ÈçºÎ¿ª·¢°²È«µÄAJAXÓ¦ÓÃ

ÈçºÎ¿ª·¢°²È«µÄAJAXÓ¦ÓÃ
AJAX¼¼ÊõÒѾ­ÊÇÏÖÔÚ×îÁ÷ÐеÄWebÓ¦Óÿª·¢¼¼ÊõÁË£¬µ«ÊÇÓë´Ëͬʱ£¬WebÓ¦ÓÃÒ²³ÉÁËÕâ¸öIT¼Ü¹¹Öа²È«×Èõ£¬×îÈÝÒ×Êܵ½¹¥»÷µÄ²¿·Ö£¬AJAXÓ¦ÓÃÏà±È½ÏÓ봫ͳµÄWebÓ¦Ó㬴ó´óÔö¼ÓÁË¿Í»§¶ËÓë·þÎñÆ÷Ö®¼äµÄ½»»¥£¬Í¬Ê±Ò²Ê¹µÃһЩºǫ́µÄÒµÎñÂß¼­½Ó¿Ú±©Â¶¸øÁË¿Í»§¶Ë£¬Èç¹û·þÎñÆ÷¶ËûÓÐ×ã¹»µÄ±£»¤»òÕßûÓжԿͻ§¶ËÇëÇó½øÐкϷ¨ÐÔУÑ飬¹¥»÷Õ߾ͻá³ÃÐé¶øÈ룬½øÈëϵͳÄÚ²¿½øÐÐÆÆ»µ¡£¿ª·¢ÈËÔ±ÈçºÎ²ÅÄÜÔÚ¿ª·¢¹¤³ÌÖб£Ö¤AJAXÓ¦ÓõݲȫÄØ£¿ Ò»ÏÂÊÇÎÒËѼ¯×ÊÁÏ×ܽá³öÀ´µÄһЩchecklistºÍbest practices£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1. ÊäÈëУÑ飬ÕâÒ»²¿·ÖÒѾ­ÔÚÎÒµÄÉÏһƪblog ÈçºÎ½øÐÐWebÓ¦Óõݲȫ²âÊÔºÍÊäÈëУÑé ÖнøÐÐÁË˵Ã÷£¬½øÐÐÊäÈëУÑéÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇBlacklisting: ¾ÍÊÇÁгöËùÓзǷ¨µÄÊäÈë½øÐÐÆÁ±Î£»ÁíÍâÒ»ÖÖÊÇWhitelisting: ¾ÍÊÇÁгöºÏ·¨µÄÊäÈë¸ñʽ£¬Ö»Òª²»ÊôÓÚÕâÖÖ¸ñʽ¶¼»®Îª·Ç·¨¸ñʽ½øÐÐÆÁ±Î¡£°²È«·½ÃæÀ´Ëµ£¬Whitelisting±ÈBlacklistingÓиü¸ßµÄ°²È«ÐÔ¡£
2. ¾¡Á¿±ÜÃ⶯̬µÄÉú³ÉºÍÖ´ÐÐcode, ÔÚjavascriptÖо¡Á¿±ÜÃâʹÓÃevalº¯Êý¡£
3. ÔÚʹÓÃjson¶ÔÏó֮ǰ¶ÔËü½øÐÐУÑ飬ÒòΪjson¶ÔÏóÒ²ÊÇjavascriptµÄÒ»²¿·Ö£¬ËùÒÔjson¶ÔÏóÀïÃæÒ²ÓпÉÄÜ°üº¬ÓÐÓк¦µÄ´úÂë£ ......

Ajax¿Ø¼þ

NO1.
ÔÚatlas(ajax)ÖÐÇ벻ҪʹÓÃResponse.Write(),
ÇëʹÓÃClientScript.RegisterClientScriptBlockÌæ»»
ʹÓÃÈçÏ£º
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('×Ô¼º¿´×Å°ì!')</script>");
×¢Ò⣺RegisterStartupScript ·½·¨Êǽ« JavaScript ǶÈëµ½ ASP.NET Ò³ÃæµÄµ×²¿£¬Ç¡ºÃλÓڹرÕÔªËØ </form> µÄÇ°Ãæ¡£RegisterClientScriptBlock ·½·¨Êǽ« JavaScript ǶÈëµ½Ò³ÃæÖпªÆôÔªËØ <form> µÄ½ôºóÃæ¡£
NO2.
FilteredTextBox¿Ø¼þÊÇÒ»¸ö·Ç³£ÓÐÓõĿؼþ£¬Ê¹ÓÃËûÄÜÖ±½Ó¹ýÂËһЩ×Ö·û¡£
Àý×Ó£º
Ò»£ºÖ»ÔÊÐíÊý×Ö
<asp:TextBox ID="TextBox1" runat="server" />
<ajaxToolkit:FilteredTextBoxExtender
           ID="FilteredTextBoxExtender1"
           runat="server"
           TargetControlID="TextBox1"
           FilterType="Numbers" />
¶þ£ºÖ»ÔÊÐíÊäÈëС×Ö×Öĸ
< ......

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


<style type="text/css">
<!--
.STYLE1 {
 font-size: 24px;
 font-weight: bold;
}
.STYLE2 {font-size: 36px}
-->
 .mouseOut {
    color: #000000;
 
 
  
    }
    .mouseOver {
     color: RED;
    }
 
     .mouseOut1 {
    background: #708090;
    color: #FFFAFA;
    }
    .mouseOver1 {
    background: #F3F3FA;
    color: #000000;
    }
  </style>
 
    cell.onmouseout = function() {this.className='mouseOver1';};
    cell.onmouseover = function() {this.className='mouseOut1';};
 
ÓÃÑùʽ±íÅäºÏ,javascript½øÐвÙ×÷,·Ç³£µÄÈÝÒ×!
......

AJAXµäÐͺ¯Êý

function createXMLHttpRequest() {   // ´´½¨XMLHTTPREQUESTµÄ±ê×¼º¯Êý.¼æÈݸ÷ä¯ÀÀÆ÷.
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
} ......

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);  
//Èç¹ûvalµÄֵΪÖÐÎÄ£¬Ôò²úÉúÂÒÂë
//½â¾ö·½·¨ºÜ¼òµ¥£ºÊ¹ÓÃjavascriptÖеÄescape(string)
º¯Êý
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+escape(val));  
//valµÄֵΪÖÐÎIJ»»á²úÉúÂÒÂë
encodeURI(encodeURI(post)); ÕâÑùÒ²¿ÉÒÔ
¹ØÓÚÔÚAjaxÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
ÓÃAjax
À´GET»ØÒ»¸öÒ³Ãæʱ£¬RESPONSETEXTÀïÃæµÄÖÐÎĶà°ë»á³öÏÖÂÒÂ룬ÕâÊÇÒòΪxmlhttpÔÚ´¦Àí·µ»ØµÄresponseTextµÄʱºò£¬ÊÇ°Ñ
resposeBody°´UTF-8±àÂë½ø½âÂ뿼Ðγɵģ¬Èç¹û·þÎñÆ÷ËͳöµÄȷʵÊÇUTF-8µÄÊý¾ÝÁ÷µÄʱºòºº×Ö»áÕýÈ·ÏÔʾ£¬¶øËͳöÁËGBK±àÂëÁ÷µÄʱºò¾ÍÂÒÁË¡£½â¾öµ ......

jQuery Ajax ʵÀýÑÝʾ

 
<html>
<head>
<title>jQuery Ajax ʵÀýÑÝʾ</title>
</head>
<script language="javascript" src="../lib/jquery.js"></script>
<script language="javascript">
$(document).ready(function ()
{
   $('#send_ajax').click(function (){
     var params=$('input').serialize(); //ÐòÁл¯±íµ¥µÄÖµ
     $.ajax({
       url:'ajax_json.php', //ºǫ́´¦Àí³ÌÐò
       type:'post',         //Êý¾Ý·¢ËÍ·½Ê½
       dataType:'json',     //½ÓÊÜÊý¾Ý¸ñʽ
       data:params,         //Òª´«µÝµÄÊý¾Ý
       success:update_page //»Ø´«º¯Êý(ÕâÀïÊǺ¯ÊýÃû)
     });
   });
//$.post()·½Ê½£º
$('#test_post').click(function (){
 &nb ......
×ܼǼÊý:703; ×ÜÒ³Êý:118; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [109] [110] [111] [112] [113] 114 [115] [116] [117] [118]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ