ÇëÎÊÒ»¸ö×î»ù±¾µÄajaxµÄÑéÖ¤ÎÊÌâ
var xmlHttp = false;
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2)
{
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined'){
xmlHttp = new XMLHttpRequest();
}
function callServer(){
var u_name = document.getElementById("TextBox1").value;
if ((u_name == null) || (u_name == "")) return;
var url = "Validate.aspx?UserName=" + escape(u_name);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = updatePage;
xmlHttp.send(null);
}
function updatePage(){
if (xmlHttp.readyState < 4){
test1.innerHTML="loading...";
}
if (xmlHttp.readyState == 4){
var response = xmlHttp.responseText;
test1.innerHTML=response;
}
}
string nam = Request.QueryString["UserName"].ToString();
if(nam=="1")
{
Response.Write("´ËÓû§ÃûÒѾ±»×¢²á"); <
Ïà¹ØÎÊ´ð£º
<div id="div6" runat="server" style= "height:auto;width:auto; text-align: left;">
& ......
´ó¼ÒºÃ£¬Çë¸ßÊÖÃÇÖ¸µã
ÎÒµÄservletÎļþÊÇ£º
package com.ljc.rank.ajax;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
......
JScript code:
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
function ajaxTest() {
var starttime = document.getElementById(&q ......
Ö÷Ò³ÖÐÓиöÄ£¿é£¨µ÷ÓÃĸ°æÒ³£©ÓÐÒ»¸öDropDownlist ºÍÒ»¸öLabel¿Ø¼þ£¬ÒªÇóÑ¡ÔñDropDownlistÖеÄÏîʱ °ÑÊý¾Ý¿âÖÐÏàÓ¦µÄÄÚÈÝÏÔʾµ½LabelÉÏ ¶ø²»Ë¢ÐÂÕû¸öÒ³Ãæ¡£
֮ǰû¶ÔAjaxÓÐÈκÎÁ˽⣬²»ÖªµÀÈçºÎʵÏÖ¾Ö²¿Ë¢Ð¡£ÏÖÔ ......
ajax×öµÄ·ÀÖ¹×¢²áÓû§ÃûÏàͬ£¿£¿£¿´«ÖÐÎÄÖµ
Ö±½ÓÓÿò¼Ü¾ÍºÜ¼òµ¥ÁË¡£ÀýÈçjsonÖ®ÀàµÄ¡£
Èç¹ûÊÇ×Ô¼ºÐ´£¬×îºÃ°ÑÖÐÎĽøÐÐÒ»ÏÂת»»£¬È»ºóÔÚºǫ́ÔÙת»»»ØÀ´¡£ÕâÑù±È½Ï±£ÏÕ¡£
ÓÃDWR°É
Â¥Ö÷ÖØµãÊÇ¡°ajax×öµÄ·ÀÖ ......