-----------------------------------------------------------------------
js获取url的参数
// JScript 文件
function GetURLRequest(Url)
{
var u,g,StrBack='',RETURNVALUE="";
if(arguments[arguments.length-1]=="#"){u=Url.split("#");}else{u=Url.split("?");}
if (u.length==1)g='';else g=u[1];
if(g!='')
{
gg=g.split("&");
var MaxI=gg.length;
str = arguments[0]+"=";
for(xm=0;xm<MaxI;xm++)
{
if(gg[xm].indexOf(str)==0)
{
StrBack=gg[xm].replace(str,"");
break;
}
RETURNVALUE+=gg[xm].substring(gg[xm].indexOf('=')+1)+"|";
}
}
return RETURNVALUE.substring(0,RETURNVALUE.length-1);
}
function getCurrentStyle(idbefore,classname)
{
var url_arr=GetURLRequest(window.location.href).split('|');//获取当前页REQUEST集合,并存入数组。
var parameters=1;
if(url_arr[0]!='')
parameters= url_arr[0];
var currentID=document.all(idbefore+parameters);
currentID.className=classname;
}
window.load=getCurrentStyle("title_list_chc","title_2");
/*
注:
getCurrentStyle(param1,param2);
param1:id="title_list_chc1"的前缀
param2: class="title_1" 选中的样式名称
在每个连接后面按1.2.3....顺序加上参数(如:?key=1),参数名随便
例:
<div id="title_list"><div class="title_1" id="title_list_chc1"><a href="../zhaoshang/touzi.shtml?key=1">投资政策</a></div>
<div class="title_1" id="title_list_chc2"><a href="../zhaoshang/daili.shtml?key=2">代理政策</a></div>
<div class="title_1" id="title_list_chc3"><a href="../zhaoshang/jishu.shtml?key=3">技术支持</a></div>
<div class="title_1" id="title_list_chc4"><a href="../zhaoshang/moshi1.shtml?key=4">投资模式</a></div>
<div class="title_1" id="title_list_chc5"><a href="../zhaoshang/baozhang.shtml?key=5">服务保障</a></div>
</div><!----title_list----->
*/JavaScript 等待收集.................
--------------------------------------------
/*
[关闭窗口]
*/
<a href="javascript:top.window.opener = top;
top.window.open('','_self','');
top.window.close();
">[关闭窗口]</a>
Tag标签: javascript