I've wrote a couple of functions to read parameters from the URL string, it works fine on NN but it doesn't works on IE. Why?
The related code is:
function getParameterValue(strParamName)
{
//********************************************************
//*
//* Function: getParameterValue()
//* Parameters: strParamName (String, parameter name)
//* Description: Returns the value of a parameter if it
//* exist, null string ("" otherwise. If
//* the given index is greater than the
//* number of elements, returns null.
//* Returns: String. If no parameter found, returns
//* a Null value.
//*
//********************************************************
var queryString = document.location.search.substring(1);
var start = queryString.indexOf(strParamName);
if(start == -1)
{
return null;
}
else
{
if( queryString.indexOf("&" == -1)
{
return queryString.substring(start + strParamName.length + 1 );
}
if( queryString.indexOf("&" == queryString.lastIndexOf("&" && queryString.indexOf("&" != -1)
{
return queryString.substring(start + strParamName.length + 1, queryString.indexOf("&"-1);
}
if(queryString.indexOf("&" != queryString.lastIndexOf("&")
{
var strTemp = queryString.substring(start);
return strTemp.substring(strTemp.indexOf("="+1,strTemp.indexOf("&"-1);
}
}
}
[sig][/sig]
The related code is:
function getParameterValue(strParamName)
{
//********************************************************
//*
//* Function: getParameterValue()
//* Parameters: strParamName (String, parameter name)
//* Description: Returns the value of a parameter if it
//* exist, null string ("" otherwise. If
//* the given index is greater than the
//* number of elements, returns null.
//* Returns: String. If no parameter found, returns
//* a Null value.
//*
//********************************************************
var queryString = document.location.search.substring(1);
var start = queryString.indexOf(strParamName);
if(start == -1)
{
return null;
}
else
{
if( queryString.indexOf("&" == -1)
{
return queryString.substring(start + strParamName.length + 1 );
}
if( queryString.indexOf("&" == queryString.lastIndexOf("&" && queryString.indexOf("&" != -1)
{
return queryString.substring(start + strParamName.length + 1, queryString.indexOf("&"-1);
}
if(queryString.indexOf("&" != queryString.lastIndexOf("&")
{
var strTemp = queryString.substring(start);
return strTemp.substring(strTemp.indexOf("="+1,strTemp.indexOf("&"-1);
}
}
}
[sig][/sig]