可以直接使用window.location.href進(jìn)行頁(yè)面跳轉(zhuǎn)
window.location.href ="./punch/clock_frm.html"
問(wèn)號(hào)傳參:?
window.location.href ="./punch/clock_frm.html?modFlag="+modFlag+'&role='+role;
那么我們?cè)谛马?yè)面接收參數(shù)肯骇, 并且將參數(shù)轉(zhuǎn)為可用的json格式時(shí)扳肛, 可以用下面的方法:?
varurl = location.search;//獲取url中"?"符后的字串 ('?modFlag=business&role=1')?
vartheRequest =newObject();
if( url.indexOf("?") !=-1) {
varstr = url.substr(1);//substr()方法返回從參數(shù)值開(kāi)始到結(jié)束的字符串;?
varstrs = str.split("&");
for(vari =0; i < strs.length; i++ ) {
theRequest[ strs[ i ].split("=")[0] ] = ( strs[ i ].split("=")[1] );
? }?
console.log( theRequest );//此時(shí)的theRequest就是我們需要的參數(shù)黍图;?
}