javascript 獲取 Reuqet值

来源:互联网 发布:php 字符串变大写 编辑:程序博客网 时间:2024/04/29 09:22
 
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. //1.函 數 名:  GetRequest()
  3. //作 用:  獲取地址欄參數值內容
  4. //輸入參數: strName 地址欄參數名稱
  5. //返 回 值:    該參數的值
  6. ///////////////////////////////////////////////////////////////////////////////////////
  7. function GetRequest(strName)
  8. {
  9.     Request = {
  10.         QueryString : function(item){
  11.             var svalue = location.search.match(new RegExp("[/?/&]" + item + "=([^/&]*)(/&?)","i"));
  12.             return svalue ? svalue[1] : svalue;
  13.         }
  14.     }
  15.     var rName=Request.QueryString(strName);
  16.     return rName;
  17. }
  18. //運用: alert(Request.QueryString("id"));
原创粉丝点击