When processing Javascript on the frontend only, you may encounter the problem of passing a webpage parameter to the next page through the get method. in this case, you can use js to obtain the get parameter in the url of the current page. the core statement is: [javascript] window. location. the detailed href code is not explained. There are comments. You can see... syntaxHighligh
When processing Javascript on the frontend only, you may encounter the problem of passing a webpage parameter to the next page through the get method.
In this case, you can use js to obtain the get parameter in the url of the current page. The core statement is:
[Javascript]
Window. location. href
The detailed code is not explained. If there is a comment, you can understand it. It is encapsulated into a jQuery extension package.
[Javascript]
/**
* JQuery url get parameters function [get url get parameter value]
* @ Character_set UTF-8
* @ Author Jerry. li (lijian@dzs.mobi)
* @ Version 1.2012.12.11.1400
* Example
*
* Var GET = $. urlGet (); // Get the URL's GET Parameter
* Var id = GET ['id']; // obtain the id value.
*
*/
; (Function ($)
{
$. Extend (
{
/**
* Url get parameters
* @ Public
* @ Return array ()
*/
UrlGet: function ()
{
Var aQuery = window. location. href. split ("? "); // Get the Get Parameter
Var aGET = new Array ();
If (aQuery. length> 1)
{Www.2cto.com
Var aBuf = aQuery [1]. split ("&");
For (var I = 0, iLoop = aBuf. length; I {
Var aTmp = aBuf [I]. split ("="); // separate the key and Value
AGET [aTmp [0] = aTmp [1];
}
}
Return aGET;
},
});
}) (JQuery );