This article describes in detail how to use JavaScript to implement QueryString to obtain GET parameters. The specific implementation is as follows. If you are interested, refer to the following:
The Code is as follows:
Select Enterprise Product
The Code is as follows:
QueryString = {
Data :{},
Initial: function (){
Var aPairs, aTmp;
Var queryString = new String (window. location. search );
QueryString = queryString. substr (1, queryString. length); // remove "? "
APairs = queryString. split ("&");
For (var I = 0; I <aPairs. length; I ++ ){
ATmp = aPairs [I]. split ("= ");
This. data [aTmp [0] = aTmp [1];
}
},
GetValue: function (key ){
Return this. data [key];
}
}
$ (Function (){
// Initialization
QueryString. Initial ();
Var type = QueryString. GetValue ("type ");
If (typeof (type )! = "Undefined "){
$ ("# Select-type"). val (type );
}
$ ("# Select-type"). bind ("change", function (){
Var row = $ (this). find ("option: selected"). val ();
// Alert (row );
If (row = 1)
Location. href = "? Type = "+ row;
If (row = 2)
Location. href = "? Type = "+ row;
});
});