日期:2014-05-16 浏览次数:20792 次
function showTab(){
var selectedTab=this.title;
var tabs=document.getElementById("tabs").getElementsByTagName("a");
for(var i=0;i<tabs.length;i++)
{
var currentTab=tabs[i];
if(currentTab.title==selectedTab)
{
currentTab.className="active";
}
else{
currentTab.className="inactive";
}
}
var request=createRequest();
if(request==null)
{
alert("Unable create request");
}
request.onreadystatechange=showSchedule;
request.open("GET",selectedTab+".html",true);
request.send(null);
function showSchedule()
{
if(request.readyState==4){
//如果去了request.status==200,界面上能获得数据
if(request.status==200)
{
document.getElementById("content").innerHTML=request.responseText;
}else{
alert(request.status);
}
}
else{
//alert(request.status);
}
}
}
alert(selectedTab+".html")//输出什么?地址不对或者跨域了
request.open("GET",selectedTab+".html",true);