·¢Ò»¶ÎAjaxµÄ´úÂë
AjAx.js
var bCheckUserPass = false;
var StrType;
function checkUsers(StrTmp)
{
var oB = window.document.all.nam
StrType=StrTmp
if (oB.length == 0) return;
/// ²»ÔÊÐíÍæ¼ÒÃûÖÐÓÐÓ¢ÎĶººÅ
for (var i=0; i<oB.length; i++)
{
if (oB.value.length > 0)
{
if (!checkUserNameHasComma(oB.value))
{
alert("´íÎó£ºÍæ¼ÒÃû×ÖÀïÃæ²»ÄÜÓÐÓ¢ÎĶººÅ(°ë½Ç¶ººÅ)£¡¡¡¡¡¡¡\nÍæ¼Ò£º"+oB.value);
return;
}
}
}
var sNames = "";
for (var i=0; i<oB.length; i++)
{
if (oB.value.length > 0)
{
sNames += oB.value;
sNames += ",";
}
}
if (sNames.length > 0)
{
sUserNames = sNames.substr(0, sNames.length-1);
getXml("checkuser");//window.setTimeout("getXml('checkuser')", 100);
}
}
/// ²»ÔÊÐíÍæ¼ÒÃûÖÐÓÐÓ¢ÎĶººÅ
function checkUserNameHasComma(sName)
{
if (sName == ""||sName == null) return false;
var oRex = /,/g;
if (sName.search(oRex) != -1) return false;
return true;
}
//-----
Ïà¹ØÎĵµ£º
±¾ÎÄÄÚÈÝÕª×Ô£º¡¶Java Web¿ª·¢½Ì³Ì——ÈëÃÅÓëÌá¸ßƪ£¨JSP+Servlet£©¡·
½»»¥µÄ»ù±¾¹ý³Ì°üÀ¨£º
l ´´½¨XMLHttpRequest¶ÔÏó£»
l ·¢ËÍÇëÇó£»
l ´¦ÀíÏìÓ¦¡£
´ ......
ÔÚʹÓÃJQueryµÄajax·ÃÎÊÒ³Ãæʱ£¬×ÜÊdzö´í£¬µÃ²»µ½·µ»ØµÄhtml´úÂ룬ÓÖ²»ÖªµÀ³öµÄʲô´í£¬°Ù˼²»µÃÆä½â
ÓÚÊǾÍÓÃXMLHTTPÈ¥·ÃÎÊ£¬½á¹ûÒ²³ö´í£¬²»¹ýÄܹ»µÃµ½´íÎóÔÒò£¬È»ºó¸ù¾Ý´íÎóÒòΪȥÍøÉϲ飬ÖÕÓڵõ½Á˴𰸡£¡£
ÔÀ´jspµÄ±àÂëÓëjavaµÄ±àÂë²»Ò»ÖÂ
·½°¸¢Ù
´íÎó
<%@ page contentType="text/html;charset= ......
ÔÚÕâ¸ö±»Ajax¼¼ÊõͳÖεĻ¥ÁªÍøʱ´ú£¬ºÜ¶àAjax³ÌÐò¶¼»áÔÚÒì²½¶ÁÈ¡Êý¾ÝµÄͬʱ£¬ÏÔʾһ¸öÕýÔÚ¶ÁÈ¡»òLoadingµÄ¶¯»£¬½ñÌì±òGoÒªÏò´ó¼Ò
ÍƼöÒ»¸öÔÚÏßÉú³ÉLoadingÔ¤Ôض¯»GifͼƬµÄÍøÕ¾£¬Ëü²»µ«ÌṩÁ˳¬¶àµÄLoading¶¯»Ñùʽ¹©ÄãÑ¡Ôñ£¬¶øÇÒÄ㻹¿ÉÒÔ×Ô¶¨Òå³ß´ç¡¢ÑÕÉ«µÈ²ÎÊý£¬¿É
ν·½±ãµ½¼Ò£¬×î×îÖØÒªµÄÊÇ£¬PreLoaders.net
Ìṩ ......
ajaxµÄÁбíÁª¶¯Ê¾Àý
1¡¢ ÊäÈëÓò£º
ÇëÑ¡ÔñÊ¡£º
<select id="sel1" onchange="return choose(this);">
<option value="">--ÇëÑ¡Ôñ--</option>
<option value="1">ºþÄÏÊ¡</option>
&nb ......