打开新窗口跳转
window.open("index.html");
本页面跳转
window.location.href = "index.html";
document.location = "index.html";
在跳转页面获得传值
带参数跳转
window.open("index.html?cid="+cid);
取值
$(document).ready(function(){
var cid= getUrlParam("cid");
alert(cid);
});
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}