window.location.href无法跳转:描述如下:
index.html文件中有<a href="main.html?link=btn1">的一个链接,点击后跳转到main.html页面,并根据所传参数设置main.html页面的一些样式。main.html文件中有<a href='#' class='selected' onclick="window.location.href='index.html'">的一个链接,点击之后无法再跳转到index.html页面了,地址栏显示“file:///D:/WebSite/jpkc/main.html?link=btn1#”。main.html用到了<body onload="init()">,代码如下
function init()
{
var request = new Object();
request = getRequest();
var theLink = request['link'];
if(theLink=='btn1'){
menuClick('h1','H');
menuClick('hs1','S');
sub_btns_click('hs1');
}
}function getRequest() {   var url = location.search; //获取url中"?"符后的字串   var theRequest = new Object();   if (url.indexOf("?") != -1) {      var str = url.substr(1);      strs = str.split("&");      for(var i = 0; i < strs.length; i ++) {         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);      }   }   return theRequest;}
怀疑这是产生问题的原因,请各位大大帮忙解决下。