<script><BR> function goto_url(url){<BR> var new_url = "http://shop.usteel.com/index.php?app=list_release";<BR> var d_date = getParameter("date",url);<BR> if(d_date != '' ){<BR> new_url = "&" d_date;<BR> }<BR> var 物种 = getParameter("物种",url) ;<BR> if(物种 != ''){<BR> new_url = "&" 物种;<BR> }<br><br> window.open(new_url);<br><br> }<BR> //javascript获取指定参数及其对应的值 <BR> function getParameter(paraStr, url) <BR> { <BR> var result = ""; <BR> //获取URL中全部参数列表数据 <BR> var str = "&" url.split("?")[1]; <BR> var paraName = paraStr "="; <BR> //判断要获取的参数是否存在 <BR> if(str.indexOf("&" paraName)!=-1) <BR> { <BR> //如果要获取的参数到结尾是否还包含“&” <BR> if(str.substring(str.indexOf(paraName),str.length).indexOf("&")!=-1) <BR> { <BR> //得到要获取的参数到结尾的字符串 <BR> var TmpStr=str.substring(str.indexOf(paraName),str.length); <BR> //截取从参数开始到最近的“&”出现位置间的字符 <BR> result=TmpStr.substr(TmpStr.indexOf(paraName),TmpStr.indexOf("&")-TmpStr.indexOf(paraName)); <BR> } <BR> else <BR> { <BR> result=str.substring(str.indexOf(paraName),str.length); <BR> } <BR> } <BR> else <BR> { <BR> result=""; <BR> } <BR> return (result.replace("&","")); <BR> } <BR> </script>
下面例子很完整 经测试