AJAXµÄjs´úÂë
//Óû§ÃûУÑéµÄ·½·¨
//Õâ¸ö·½·¨½«Ê¹ÓÃXMLHTTPRequest¶ÔÏóÀ´½øÐÐAJAXµÄÒì²½Êý¾Ý½»»¥
var xmlhttp;
function verify() {
//0¡£Ê¹ÓÃdomµÄ·½Ê½»ñÈ¡Îı¾¿òÖеÄÖµ
//document.getElementById("userName")ÊÇdomÖлñÈ¡ÔªËؽڵãµÄÒ»ÖÖ·½·¨£¬Ò»¸öÔªËؽڵã¶ÔÓ¦HTMLÒ³ÃæÖеÄÒ»¸ö±êÇ©£¬Èç¹û<input>
//¡£value¿ÉÒÔ»ñÈ¡Ò»¸öÔªËؽڵãµÄvalueÊôÐÔÖµ
var userName = document.getElementById("userName").value;
//1.´´½¨XMLHttpRequest¶ÔÏó
//ÕâÊÇXMLHttpReuquest¶ÔÏóÎÞ²¿Ê¹ÓÃÖÐ×ÔÓµÄÒ»²½
//ÐèÒªÕë¶ÔIEºÍÆäËûÀàÐ͵Ää¯ÀÀÆ÷½¨Á¢Õâ¸ö¶ÔÏóµÄ²»Í¬·½Ê½Ð´²»Í¬µÄ´úÂë
if (window.XMLHttpRequest) {
//Õë¶ÔFireFox£¬Mozillar£¬Opera£¬Safari£¬IE7£¬IE8
xmlhttp = new XMLHttpRequest();
//Õë¶ÔijЩÌض¨°æ±¾µÄmozillarä¯ÀÀÆ÷µÄBUG½øÐÐÐÞÕý
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType("text/xml");
}
} else if (window.ActiveXObject) {
//Õë¶ÔIE6£¬IE5.5£¬IE5
//Á½¸ö¿ÉÒÔÓÃÓÚ´´½¨XMLHTTPRequest¶ÔÏóµÄ¿Ø¼þÃû³Æ£¬±£´æÔÚÒ»¸öjsµÄÊý×éÖÐ
//ÅÅÔÚÇ°ÃæµÄ°æ±¾½ÏÐÂ
var activexName = ["MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
for (var i = 0; i < activexName.length; i++) {
try{
//È¡³öÒ»¸ö¿Ø¼þÃû½øÐд´½¨£¬Èç¹û´´½¨³É¹¦¾ÍÖÕֹѻ·
//Èç¹û´´½¨Ê§°Ü£¬»ØÅ׳öÒì³££¬È»ºó¿ÉÒÔ¼ÌÐøÑ»·£¬¼ÌÐø³¢ÊÔ´´½¨
xmlhttp = new ActiveXObject(activexName[i]);
break;
} catch(e){
}
}
}
//È·ÈÏXMLHTtpRequest¶ÔÏó´´½¨³É¹¦
if (!xmlhttp) {
alert("XMLHttpRequest¶ÔÏó´´½¨Ê§°Ü!!");
return;
} else {
alert(xmlhttp.readyState);
}
//2.×¢²á»Øµ÷º¯Êý
//×¢²á»Øµ÷º¯Êýʱ£¬Ö®ÐèÒªº¯ÊýÃû£¬²»Òª¼ÓÀ¨ºÅ
//ÎÒÃÇÐèÒª½«º¯ÊýÃû×¢²á£¬Èç¹û¼ÓÉÏÀ¨ºÅ£¬¾Í»á°Ñº¯ÊýµÄ·µ»ØÖµ×¢²áÉÏ£¬ÕâÊÇ´íÎóµÄ
xmlhttp.onreadystatechange = callback;
//3¡£ÉèÖÃÁ¬½ÓÐ
Ïà¹ØÎĵµ£º
AjaxPro.2.dll µÄʹÓÃʵÀý(2008-09-20 11:13:25)±êÇ©£ºajax it ·ÖÀࣺajax
×¼±¸¹¤×÷£ºÏîÄ¿ÖÐÒªÒýÓÃAjaxPro.2.dll£¬Õâ¸ö²½Öè¾ÍÊ¡ÂÔÁË£¬¹þ¹þ
µÚÒ»²½£ºweb.config
<system.web>
<httpHandlers>
<add verb ......
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<input type="button" onclick="test();" value="Ìá½»"/>
<script type="text/javascript">
function test(){
var valid = {
& ......
±¾ÎĽ«Ê¹ÓÃAjaxToolkitÖеē PopupControlExtender £¬ DynamicPopulateExtender £¬ DragPanelExtender ”¿Ø¼þÀ´¹¹½¨Ò»¸öµ¯³ö¶Ô»°¿ò£¬¿ÉÒÔʵÏÖµ¯³ö¶Ô»°¿ò£¬¶Ô»°¿ò¿ÉÍ϶¯µÈ¹¦ÄÜ¡£±È½ÏÊʺÏ×öÿÈÕÒ»ÌùµÈЧ¹û
Ê×ÏȽâÊÍÏ ......
½ñÌì°ïͬʽâ¾öÁËjsÒì²½µ÷ÓÃʱ³öÏÖÁËÖÐÎÄÂÒÂëµÄÎÊÌ⣬¾ßÌå½â¾ö°ì·¨ÈçÏ£º
1£©Ê×ÏÈÈ·ÈÏjsÊÇ·ñûÓжԺǫ́´«Êä¹ýÀ´µÄÖÐÎĽøÐнâÂë¡£
°´ÕÕÍøÂçÉÏдµÄ·½·¨Í¨¹ýjs¶ÔresponseµÄ¶ÁÈ¡³öÀ´Êý¾Ý½øÐжà´Î²âÊÔ£¬·¢ÏÖÈÔÈ»²»Äܽâ¾ö£¬Ï¸Ïë²»Ò»¶¨ÊÇ´Ë´¦ÎÊÌâ¡£¸Ä»»ÆäËû°ì·¨½â¾ö¡£
2£©Èç¹û½âÂë½â¾ö²»ÁË£¬ÔÙ¿´ÊÇ·ñÊÇÒòΪÍø ......