希望用Js获取静态页面的id..
比如:http://www.**.com/index.html?id=2009就想用Js获取2009这个id,在静态页面中输出。。这个已经搞定。。
求助:如何做到用户访问了http://www.**.com/index.html?id=2009这个页面后,再访问其他静态页面,在其他静态页面中还能输出2009这个id...
麻烦详细点,本人新手,先谢谢老大们!!!!
比如:http://www.**.com/index.html?id=2009就想用Js获取2009这个id,在静态页面中输出。。这个已经搞定。。
求助:如何做到用户访问了http://www.**.com/index.html?id=2009这个页面后,再访问其他静态页面,在其他静态页面中还能输出2009这个id...
麻烦详细点,本人新手,先谢谢老大们!!!!
if(!s)var s=location.search;
var r=new RegExp("^\\?(?:"+n+"=|.+=.*&"+n+"=)([^&]+).*","i");
if(r.test(s)){
return unescape(s.replace(r,"$1"));
}else{
return null;
}
}
function Cg(n){//读取cookie
var c=document.cookie.match(new RegExp("(^| )"+n+"=([^;]*)(;|$)"));
if(c==null){
return null;
}else{
return unescape(c[2]);
}
}
function Cs(n,v,s){//存储cookie
if(!s)var s=86400000000;
var d=new Date();
d.setTime(d.getTime()+s);
document.cookie=n+"="+escape(v)+";expires="+d.toGMTString();
}
/**********首页代码**********/
var id=Gs("id");//首页获取url ID
Cs("id",id);//存储cookie ID/**********其它页代码**********/
var id=Cg("id");