用javascript获得地址栏参数的两种方法
<script language=JavaScript><!--function Request(strName){var strHref = www.abc.com/index.htm?a=1&b=1&c=测试测试;var intPos = strHref.indexOf(?);var strRight =
strHref.substr(intPos + 1);var arrTmp = strRight.split(&);for(var i = 0; i < arrTmp.length; i++){var arrTemp = arrTmp.split(=);if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];}return ;}alert(Request(a));alert(Request(b));alert(Request(c));//--></script><script>String.prototype.getQuery = function(name){ var reg = new RegExp((^|&)+ name +=([^&]*)(&|$));
var r = this.substr(this.indexOf(\?)+1).match(reg); if (r!=null) return unescape(r[2]); return null;}var str =
www.abc.com/index.htm?a=1&b=1&c=测试测试;alert
(str.getQuery(a));alert(str.getQuery(b));alert(str.getQuery(c));</script>
<script language=JavaScript><!--function Request(strName){var strHref = www.abc.com/index.htm?a=1&b=1&c=测试测试;var intPos = strHref.indexOf(?);var strRight =
strHref.substr(intPos + 1);var arrTmp = strRight.split(&);for(var i = 0; i < arrTmp.length; i++){var arrTemp = arrTmp.split(=);if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];}return ;}alert(Request(a));alert(Request(b));alert(Request(c));//--></script><script>String.prototype.getQuery = function(name){ var reg = new RegExp((^|&)+ name +=([^&]*)(&|$));
var r = this.substr(this.indexOf(\?)+1).match(reg); if (r!=null) return unescape(r[2]); return null;}var str =
www.abc.com/index.htm?a=1&b=1&c=测试测试;alert
(str.getQuery(a));alert(str.getQuery(b));alert(str.getQuery(c));</script>
alert(document.location.href);
</SCRIPT>