SoFunction
Updated on 2025-04-10

Implementation method using JS to obtain the value of the parameter

As shown below:

function getArgs(strParame) {
var args = new Object( );
var query = (1); // Get query string
var pairs = ("&"); // Break at ampersand
for(var i = 0; i < ; i++) {
var pos = pairs[i].indexOf('='); // Look for "name=value"
if (pos == -1) continue; // If not found, skip
var argname = pairs[i].substring(0,pos); // Extract the name
var value = pairs[i].substring(pos+1); // Extract the value
value = decodeURIComponent(value); // Decode it, if needed
args[argname] = value; // Store as a property
}
return args[strParame]; // Return the object
}

Use routines:

?ID=111

var x = getArgs("ID");

The value of x is: 111

The above is all the content of the method of obtaining the value of the () parameter through JS brought to you. I hope it will be helpful to everyone and support me more~