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

³õʶAjax¼¼Êõ2


 ÊµÏÖ×¢²á½çÃæÎÞË¢ÐÂÅжÏÖØÃû£¬ÓÉÓÚÒª·ÃÎÊÊý¾Ý¿â£¬ËùÒÔÒª´ïµ½ÎÞˢУ¬Ö»ÄÜÓÃAjax¼¼Êõ¡£
 ÆäÖÐ×îÖØÒªµÄ¾ÍÊÇxmlHttp¶ÔÏó¡£
XmlHttpÊÇʲô£¿
×îͨÓõĶ¨ÒåΪ£ºXmlHttpÊÇÒ»Ì׿ÉÒÔÔÚJavascript¡¢VbScript¡¢JscriptµÈ½Å±¾ÓïÑÔÖÐͨ¹ýhttpЭÒé´«ËÍ»ò´Ó½ÓÊÕXML¼°ÆäËûÊý¾ÝµÄÒ»Ì×API¡£XmlHttp×î´óµÄÓô¦ÊÇ¿ÉÒÔ¸üÐÂÍøÒ³µÄ²¿·ÖÄÚÈݶø²»ÐèҪˢÐÂÕû¸öÒ³Ãæ¡£
À´×ÔMSDNµÄ½âÊÍ£ºXmlHttpÌṩ¿Í»§¶Ëͬhttp·þÎñÆ÷ͨѶµÄЭÒé¡£¿Í»§¶Ë¿ÉÒÔͨ¹ýXmlHttp¶ÔÏó(MSXML2.XMLHTTP.3.0)Ïòhttp·þÎñÆ÷·¢ËÍÇëÇó²¢Ê¹ÓÃ΢ÈíXMLÎĵµ¶ÔÏóÄ£ÐÍMicrosoft® XML Document Object Model (DOM)´¦Àí»ØÓ¦¡£
ÏÖÔڵľø¶Ô¶àÊýä¯ÀÀÆ÷¶¼Ôö¼ÓÁ˶ÔXmlHttpµÄÖ§³Ö£¬IEÖÐʹÓÃActiveXObject·½Ê½´´½¨XmlHttp¶ÔÏó£¬ÆäËûä¯ÀÀÆ÷È磺Firefox¡¢OperaµÈͨ¹ýwindow.XMLHttpRequestÀ´´´½¨xmlhttp¶ÔÏó¡£
 ÔÚ²Ù×÷Ò³µÄǰ̨´úÂëÖÐ <input  ID="tbUserName" type="text"   onblur ="tbUserName_onBlue(this.value)">
 Ê¹ÓÃhtmlÎı¾¿ò£¬¼´¿Í»§¶Ë¿Ø¼þ ´¥·¢ËûµÄonblurʼþµ÷ÓÃjsº¯Êý¡£
 ÔÚjsÎļþÖж¨Òå¸Ãº¯Êý
 // JavaScript Document
var xmlHttp;//È«¾ÖXMLHttpResquest¶ÔÏó
//Õë¶Ô²»Í¬ä¯ÀÀÆ÷£¬»ñÈ¡XMLHttpRequest¶ÔÏó
function CreateXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
xmlHttp=new XMLHttpResquest();
}
}
//À뿪tbUserNameʱµ÷ÓõÄJSº¯Êý
function tbUserName_onBlue(name)
{
//´´½¨XMLHTTPRquest¶ÔÏó
CreateXMLHttpRequest();

//Ö¸¶¨»Øµ÷º¯Êý
xmlHttp.onreadystatechange=HandleStateChange;

//´ò¿ªÇëÇó
xmlHttp.open("GET","ForAjax.aspx?name=" + name,true);

//·¢ËÍÇëÇó
xmlHttp.send(null);

}
//»Øµ÷º¯Êý
function HandleStateChange()
{

if(xmlHttp.readyState==4) //·µ»Øµ±Ç°ÇëÇóµÄ״̬£¬Ö»¶Á
{
if(xmlHttp.status==200) //·µ»Øµ±Ç°ÇëÇóµÄhttp״̬Âë.Ö»¶Á
{
//responseTextΪ½ÓÊÕ·þÎñÆ÷·¢¹ýÀ´µÄÖµ

if(xmlHttp.responseText=="wrong1")
{
document.getElementById("sp1").innerText ="Óû§Ãû²»ÄÜΪ¿Õ£¡";
document.getEl


Ïà¹ØÎĵµ£º

AJAX Control ToolkitµÄ°²×°

  ĬÈÏÇé¿öÏÂAJAX Control Toolkit²¢Ã»Óа²×°µ½VS2008ÖУ¬¿ª·¢ÈËÔ±ÐèÒªµ¥¶ÀÏÂÔز¢½øÐа²×°¡£ÍøÖ·ÈçÏ£ºhttp://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27326 £¬AJAX Control ToolkitÊÇÒ»¸ö²»¶Ï¸üеÄÏîÄ¿£¬¸ÃÍøÒ³½«Ã¿¶Îʱ¼äÄÚ·¢²¼¶Ô¸Ã¹¤¾ß°üµÄ¸üС£ÔÚ¸ÃÒ³ÃæÖÐÑ¡ÔñAJAXControlToolki ......

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

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

AJAX ¿ò¼ÜJqueryµÄʹÓ÷½·¨

 AJAX Á÷ÐÐÖ®ºó£¬×ÜÏëºÃºÃѧϰһÏ¡£µ«ÊÇÖÚ¶àµÄ¿ò¼ÜʵÔÚÄÑÒÔÑ¡Ôñ¡£ËµÃ÷һϠASP.NET AJAX ²¢²»°üÀ¨ÔÚ AJAX ¿ò¼ÜÖ®ÖС£
¸Õ¿ªÊ¼Ñ§ÁË JQuqery£¬ ÖÚ¶àµÄ $get(),...µÈµÈ·ûºÅÔçÒÑ°ÑÎÒ¸ãÔÎÁË¡£ÔÝʱ¾Í·ÅÆúÁË¡£
ºóÀ´Ñ§Ï° ASP.NET AJAX £¬ÔÚ΢ÈíµÄÁ쵼ϣ¬Öð½¥ÓÉ·þÎñÆ÷¶ËתÏò¿Í»§¶Ë±à³Ì¡£ ¼¤ÆðÎÒ¿Í»§¶Ë±à³ÌµÄÐËȤ£¬
²ÅÏëÆðѧ ......

ÓÃAjax¶ÁÈ¡xmlÎļþµÄ¼òµ¥Àý×Ó

 AjaxµÄÔ­ÀíºÜ¼òµ¥£¬¾ÍÊÇÔÚ¿Í»§¶Ë´´½¨Ò»¸öXMLHttpRequest¶ÔÏó£¨ÓÃÀ´Óë·þÎñÆ÷½øÐÐÒ첽ͨÐÅ£¬Õâ¾ÍÊÇAjaxµÄºËÐÄ£¬ÆäʵÎÒÃÇÔç¾ÍÔÚÓÃÒ첽ͨÐÅÁË£¬Ö»ÊÇû°ÑÕâÏî¼¼ÊõÓÃÔÚÍøÒ³Éè¼ÆÖжøÒÑ£©£¬Îª¸Ã¶ÔÏóµÄonreadystatechange ÊôÐÔÌí¼ÓÒ»¸öʼþ£¬µ±¶ÔÏóµÄreadyState¸Ä±äµÄʱºò¾Í»áÒý·¢Ö¸¶¨µÄʼþ¡£µ½´Ë¾Í¿ÉÒԾͷ¢ËÍÇëÇó¶ÁÈ¡·þÎñÆ÷¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ