The getParam function accepts one parameter. The following lines of code show a typical call to getParam, the function declaration, and the parameter. This call to getParam is from the window_onLoad function in ActivityList.js; all *List.js files contain similar, if not identical, window_onLoad functions.
var id = getParam('id');
…
function getParam(name) {
In the following example, the variable myParm contains the parameter value in uppercase and the variable search contains the value of the search property, which is the substring of the href property that follows the "?" symbol. For example, if a user clicks a name from the group list and the identifier for that entry is 4, the search property contains the substring "?filename = Group&ID = 4".
var myParm = name.toUpperCase();
var search = document.location.search;
The "?" is removed from the string and the split method is applied twice to the string contents of the search variable to locate a match for the parameter that is passed to the function.
search = search.substr(1); // remove '?'
var params = search.split('&');
for (var i=0; i<params.length; i++) {
var pair = params[i].split('=');
If a match on the name of the parameter is found, the function returns the decoded value of the parameter. The JavaScript unescape method returns a new String object that contains the contents of pair[1].
if (pair[0].toUpperCase() == myParm) {
return unescape(pair[1]);
Note The unescape method replaces characters encoded in %uxxxx format (Unicode characters) with Unicode characters in hexadecimal encoding xxxx format.