当前位置导航:炫浪网>>网络学院>>网页制作>>JSP教程

Javascript中获得地址栏参数QueryString

<HTML><HEAD><TITLE>都市女孩社区</TITLE>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<LINK href="scrool.css" type=text/css rel=stylesheet>
<style type="text/css">
.navPoint
{
COLOR: #444444; CURSOR: hand; FONT-FAMILY: Webdings; FONT-SIZE: 9pt
}
</style>
<script language=javascript>
function GetQueryvalue(sorStr,panStr)
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CopyRight: 网络有限公司 Joysos.Com
Description: 在javascript内实现QueryString

CreatDate: 2004-02-28
AuthorName:: WuMeibo [email protected]
LastUpdate:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
var vStr="";
if (sorStr==null || sorStr=="" || panStr==null || panStr=="") return vStr;
sorStr = sorStr.toLowerCase();
panStr += "=";
var itmp=sorStr.indexOf(panStr);
if (itmp<0){return vStr;}
sorStr = sorStr.substr(itmp + panStr.length);
itmp=sorStr.indexOf("&");
if (itmp<0)
{
return sorStr;
}
else
{
sorStr=sorStr.substr(0,itmp);
return sorStr;
}
}



function LoadFrame()
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CopyRight: 网络有限公司 Joysos.Com
Description: 根据QueryString动态加载右侧框架

CreatDate: 2004-02-28
AuthorName:: WuMeibo [email protected]
LastUpdate: By wumeibo 2003-03-09
url参数变更 增加可以链到任意文章
和论坛且左侧导航条可根据参数变化
注:
url参数lefttree优先权最高
其次为topic
再次为forum
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/


var url = "main.htm?";
var strGetQuery = document.location.search;

//根据forum参数加载指定的论坛到右侧框架;
var forum = GetQueryvalue(strGetQuery,'forum');
//根据forum参数加载指定的文章到右侧框架;
var topic = GetQueryvalue(strGetQuery,'topic');
//根据forum参数加载指定的导航条坛到右侧框架;
var lefttree = GetQueryvalue(strGetQuery,'lefttree');

if( lefttree.toUpperCase() != "DJ" )
{
//刷新左侧导航条为都市女孩;
tree.location.href="index/index.files/111.htm";
}
else
{ //刷新左侧导航条为DJ大联盟;
tree.location.href="index/index.files/222.htm";
}

url="main.htm?forum="+forum+"&topic="+topic;
ZhuFrame.location.href=url;

}
</script>
<script>
if(self!=top)
{

top.location=self.location;
}
function switchSysBar()
{ //中间点击按钮的文字变化

if (switchPoint.innerText=="3")
{
switchPoint.innerText="4"
document.all("frmTitle").style.display="none"
}
else
{
switchPoint.innerText="3"
document.all("frmTitle").style.display=""
}
}
</script>
</HEAD>
<!-- 使用按钮控制导航菜单的显示与关闭,这部分代码暂时停止工作 2004-03-03 by 武眉博 [email protected]
<FRAMESET name=fstMain onload="LoadFrame()" cols=130,*>
<FRAME border=1 name=tree src="index/index.files/111.htm"
frameBorder=auto noResize target="_self">
<FRAME name=ZhuFrame id=ZhuFrame borderColor=#000000
frameBorder=auto target="_self"></FRAMESET><noframes></noframes>
-->
<body style="MARGIN: 0px" scroll=no onResize=javascript:parent.tree.location.reload() onload="LoadFrame()" topmargin=0>
<table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
<tr>
<td width="140" align="left" vAlign="center" noWrap id="frmTitle" name="frmTitle">
<iframe frameBorder="1" name="tree" scrolling=auto src="index/index.files/111.htm" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 140px; Z-INDEX: 2">
</iframe></td>
<td style="WIDTH: 8pt">
<table border="0" cellPadding="0" cellSpacing="0" height="100%" bgcolor=#CCCCCC>
<tr>
<td style="HEIGHT: 100%" onclick="switchSysBar()">
<font style="FONT-SIZE: 9pt; CURSOR: #000000; COLOR: #666666">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<span class="navPoint" id="switchPoint" title="关闭/打开导航栏">3</span><br>
<br>
<br>
<br>
<br>
<br>
</font></td>
</tr>
</table>
</td>
<td style="WIDTH: 100%">
<iframe frameBorder="0" name="ZhuFrame" scrolling="yes" src=../../main.htm style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1">
</iframe>
</td>
</tr>
</table>
</html>
<script>
if(window.screen.width<'1024')
{
//如果客户端显示器分辨率(宽)小与1024象素,则隐藏左侧导航;
switchSysBar();
}
</script>



相关内容
赞助商链接