getParameter(){
var url = location.search; //获取url中"?"符后的字串
var objParameter = new Object();
if ( url.indexOf( "?" ) != -1 ) {
var str = decodeURI(url).substr( 1 );
var strs = str.split( "&" );
for ( var i = 0; i < strs.length; i++ ) {
objParameter[ strs[ i ].split( "=" )[ 0 ] ] = ( strs[ i ].split( "=" )[ 1 ] );
}
console.log( objParameter ); //此时的objParameter 就是我们需要的参数;
}
}
获取url地址栏参数
最新推荐文章于 2024-07-04 10:04:23 发布