如何使用jQuery从页面中获取GET参数值?
- 内容介绍
- 文章标签
- 相关推荐
本文共计100个文字,预计阅读时间需要1分钟。
javascriptvar type=getUrlParameter('type'); // 获取URL中type参数的值
// 获取URL参数的函数function getUrlParameter(sParam) { var sPageURL=decodeURIComponent(window.location.search.substring(1)), sURLVariables=sPageURL.split('&'), sParameterName, i;
for (i=0; i
//jQuery获取get传值 function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } };
本文共计100个文字,预计阅读时间需要1分钟。
javascriptvar type=getUrlParameter('type'); // 获取URL中type参数的值
// 获取URL参数的函数function getUrlParameter(sParam) { var sPageURL=decodeURIComponent(window.location.search.substring(1)), sURLVariables=sPageURL.split('&'), sParameterName, i;
for (i=0; i
//jQuery获取get传值 function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } };

