javascript html 靜態(tài)頁面?zhèn)鲄?shù)
更新時間:2009年04月10日 20:20:09 作者:
靜態(tài)頁面中用js獲取頁面參數(shù)的一些屬性方法,具體的獲取參數(shù),可以搜索本站以前的一些文章。
復制代碼 代碼如下:
<script>
function getParam()
{
urlInfo=window.location.href; //獲取當前頁面的url
intLen=urlInfo.length; //獲取url的長度
offset=urlInfo.indexOf("?"); //設置參數(shù)字符串開始的位置
strKeyValue=urlinfo.substr(offset,len); //取出參數(shù)字符串 這里會獲得類似“id=1”這樣的字符串
arrParam=strKeyValue.split("="); //對獲得的參數(shù)字符串按照“=”進行分割
strParamValue=arrParam[1]; //得到參數(shù)值
alert("您要傳遞的參數(shù)值是"+strParamValue);
}
</script>