Hello guys
see if you can help me with this strange problem:
I have the following javascript function:
function changeNumberOfItems() {
var form = document.forms[0];
var [B]totalNumberOfItems
[COLOR=green]alert(“”” + totalNumberOfItems + “””);
totalNumberOfItems = totalNumberOfItems.replace(/^s+/,””);
totalNumberOfItems = totalNumberOfItems.replace(/s+$/,””);
[COLOR=green]alert(“”” + totalNumberOfItems + “””);
form.action = “browsing.php?page=1&itemsPerPage=25&[B]numItems=” + totalNumberOfItems
[COLOR=green]alert(form.action);
form.submit();
}
The value that I obtain from a form element (the bold one) comes from a textfield. I trim all whitespaces from around its value and the second alert shows me that indeed whitespaces have been removed.
The last alert shows me the URL encoding that the browser will request.
However, when the function executes, the actual URL that is displayed in the browser has an addtional + sign before the totalNumberOfItems value.
For example: instead of browsing.php?page=1&itemsPerPage=25&numItems=7
The URL in the address bar reads: browsing.php?page=1&itemsPerPage=25&numItems=[COLOR=red]+
Does anyone know what I am doing wrong?
thanks