/ / Change the variable value in the URL
Function Chgurlvar (Varurl, Varname, Varvalue)
{
Var POSVAR = VARURL.lastIndexof ("&" VarName "=");
IF (POSVAR == - 1) {POSVAR = VARURL.lastIndexof ("?" varname "=")}
IF (POSVAR == - 1) // URL does not exist this variable
{
IF ("?") == - 1) // URL does not have other variables
{
RETURN VARURL "?" VarName "=" VARVALUE;
} else {
Return VARURL "&" VarName "=" VARVALUE ;;
}
}
Var strbeforevar = varURL.substring (0, POSVAR);
Varurl2 = varURl.substring (POSVAR 2);
IF (Varurl2.indexof ("&") == - 1)
{
VARURL2 = ""
} else {
VarURL2 = varURL2.substring (Varurl2.indexof ("&"));
}
IF (strbeforevar.lastindexof ("?") == - 1)
{
RETURN STRBEFOREVAR "?" VarName "=" VARVALUE VARURL2;
} else {
Return strbeforevar "&" varname "=" VARVALUE VARURL2 ;;
}
}