A
Aaron Gray
I put together the following code to get the href's parameters :-
function GetParameters()
{
var arg = new Object();
var href = document.location.href;
if ( href.indexOf( "?") != -1)
{
var params = href.split( "?")[1];
var param = params.split("&");
for (var i = 0; i < param.length; ++i)
{
var name = param.split( "=")[0];
var value = param.split( "=")[1];
arg[name] = value;
}
}
return arg;
}
document.open();
var args = GetParameters();
document.write( "date = " + args["date"] + "<BR>");
document.write( "time = " + args["time"] + "<BR>");
document.close();
What I would like to do is return Undefined if there are no parameters, how
do I do this ?
Any other tips that maybe useful ?
Aaron
function GetParameters()
{
var arg = new Object();
var href = document.location.href;
if ( href.indexOf( "?") != -1)
{
var params = href.split( "?")[1];
var param = params.split("&");
for (var i = 0; i < param.length; ++i)
{
var name = param.split( "=")[0];
var value = param.split( "=")[1];
arg[name] = value;
}
}
return arg;
}
document.open();
var args = GetParameters();
document.write( "date = " + args["date"] + "<BR>");
document.write( "time = " + args["time"] + "<BR>");
document.close();
What I would like to do is return Undefined if there are no parameters, how
do I do this ?
Any other tips that maybe useful ?
Aaron