my page http://www.dinomuhic.com/2010/index.php loads the Showreel at the start of the page using an onLoad call in body like this:
You need to parse the query string. I find the easiest way to deal with the query string is to do the following. First, you need to extract the query string from the URL:
var queryStr = window.location.search; // will give you ?sndReq=234
Then, you can strip out the ?
and split each query string parameter into an array:
var paramPairs = queryStr.substr(1).split('&');
Now you can build a hash table object of the name/value pairs making up the query string:
var params = {};
for (var i = 0; i < paramPairs.length; i++) {
var parts = paramPairs[i].split('=');
params[parts[0]] = parts[1];
}
In your onload
, you can now use the parameter thusly:
sndReq(params.sndReq);
Make sure that the code is run within a script in the head
of your document so that it's computed before the onload
is executed.