/** * 方法说明:通过url参数键值名称获取参数的值 * @method getQueryString * @param name 要获取的参数键值 * @return * @remark */var getQueryString=function(name){ try { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; } catch(e) { info("系统错误:001004"); }};
例如
openWindow('lineStage/merchant/baseIndex.htm','达分期','fromUrl=myLimitSuccess & openType=1',0,'');
那么在baseIndex.htm获取链接后面的参数这么获取
var openType = getQueryString("openType");
if(openType==1){ console.lof(11);}else{
}
2.获取带参数的链接,拆分,然后拼接打开页面
var strLinkToUrl = cdoADBanner[0].getStringValue("strLinkToUrl"); // banner href链接var url,params;if(strLinkToUrl){ url = strLinkToUrl.split('?')[0]; params = strLinkToUrl.split('?')[1]; }; $('.lend-banner').click(function () { if(strLinkToUrl){ openWindow(url,'',params,0,''); }})