JavaScript获取url参数的值
2015-04-22来源:易贤网

JavaScript获取url参数的值

ORYX.Utils = {

/**

* General helper method for parsing a param out of current location url

* @example

* // Current url in Browser => ""

* ORYX.Utils.getParamFromUrl("param") // => "value"

* @param {Object} name

*/

getParamFromUrl: function(name){

name = name.replace(/[\[]/, ", "]");

var regexS = "[\\?&]" + name + "=([^&#]*)";

var regex = new RegExp(regexS);

var results = regex.exec(window.location.href);

if (results == null) {

return null;

}

else {

return results[1];

}

}

}

更多信息请查看IT技术专栏

2026公务员·事业单位培训课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息