<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<script>
var xmlhttp;
function ajax(varHref,divTagValue){
if(window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
else if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
xmlhttp.open("GET",varHref,true);
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
alert(divTagValue);
divTagValue.innerHTML=xmlhttp.responseText;//----------------请注意这里!!---------
}
}
}
xmlhttp.send(null);
}
</script>
<body>
<%
int i=0;
while(i<5){
i++;
%>
<%String divTag= "div"+i;%><a style="cursor:hand" divTagValue="<%=divTag%>" varhref="asdf.jsp" οnclick="ajax(this.varhref,this.divTagValue)">点击这里</a><br>
<div id="<%=divTag%>"></div>
<% } %>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<script>
var xmlhttp;
function ajax(varHref,divTagValue){
if(window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
else if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
xmlhttp.open("GET",varHref,true);
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
alert(divTagValue);
divTagValue.innerHTML=xmlhttp.responseText;//----------------请注意这里!!---------
}
}
}
xmlhttp.send(null);
}
</script>
<body>
<%
int i=0;
while(i<5){
i++;
%>
<%String divTag= "div"+i;%><a style="cursor:hand" divTagValue="<%=divTag%>" varhref="asdf.jsp" οnclick="ajax(this.varhref,this.divTagValue)">点击这里</a><br>
<div id="<%=divTag%>"></div>
<% } %>
</body>
</html>