这段代码在我本机上运行都没问题,可是别人访问就不行.我部署到服务器上,我访问没问题,别人就有问题..到底怎么回事???
function getchannelcategory(){
var userId="<%=user%>"; if(!userId){
document.getElementById("main1").innerHTML="选择一级分类";
return;
}else{
if(xmlhttpobj){//如果创建对象xmlhttpobj成功
xmlhttpobj.open('get',"<%=request.getContextPath()%>/loadSelectAction.jhtml?userid="+userId,true);//get方法 加个随机数。
xmlhttpobj.send(null);
xmlhttpobj.onreadystatechange=function(){//客户端监控函数
if(xmlhttpobj.readyState==4){//服务器处理请求完成
if(xmlhttpobj.status==200){
//alert('ok');
var html = xmlhttpobj.responseText;//获得返回值
document.getElementById("main1").innerHTML="<select name='channel' onchange='getsubcategory(this.value);'><option value='0' selected>选择频道</option>"+html+"</select>";
}else{
document.getElementById("main1").innerHTML="对不起,您请求的页面有问题...";
}
}else{
document.getElementById("main1").innerHTML="加载中,请梢候...";//服务器处理中
}
}
}else{
alert('xmlhttpreuqest is null');
}
}
} if (document.all){
window.attachEvent('onload',getchannelcategory)
}
else{
window.addEventListener('load',getchannelcategory,false);
}
function getchannelcategory(){
var userId="<%=user%>"; if(!userId){
document.getElementById("main1").innerHTML="选择一级分类";
return;
}else{
if(xmlhttpobj){//如果创建对象xmlhttpobj成功
xmlhttpobj.open('get',"<%=request.getContextPath()%>/loadSelectAction.jhtml?userid="+userId,true);//get方法 加个随机数。
xmlhttpobj.send(null);
xmlhttpobj.onreadystatechange=function(){//客户端监控函数
if(xmlhttpobj.readyState==4){//服务器处理请求完成
if(xmlhttpobj.status==200){
//alert('ok');
var html = xmlhttpobj.responseText;//获得返回值
document.getElementById("main1").innerHTML="<select name='channel' onchange='getsubcategory(this.value);'><option value='0' selected>选择频道</option>"+html+"</select>";
}else{
document.getElementById("main1").innerHTML="对不起,您请求的页面有问题...";
}
}else{
document.getElementById("main1").innerHTML="加载中,请梢候...";//服务器处理中
}
}
}else{
alert('xmlhttpreuqest is null');
}
}
} if (document.all){
window.attachEvent('onload',getchannelcategory)
}
else{
window.addEventListener('load',getchannelcategory,false);
}
别人访问的话,应该在页面加载生成的select:channel没有,也没其它的错误提示..