[Javascript] Replacing special characters in query string in javascript

Rajaram Sahasranaman rajarsn at gmail.com
Wed Apr 4 06:14:58 CDT 2007


Hi

I have a peculiar problem in my application. I have a query string in
javascript which I have to pass the Team Name to the next page. Everything
is working fine, but suddenly there is a problem occurs now. That is, if
there is any ampersand character in the team name, it is not taking the
characters after that.

For eg: the team name can be Printing & Stationery. So the query string will
take upto Printing and avoid after that. How to add these special character
along with he query string in javascript? Can anyone please help me? I have
coded as follows, but could not continue, stuck with the last line of code.


 var HCTTeamName = document.MyForm.TEAM.value;
var checkampersand = HCTTeamName.indexOf('&');
 //alert(checkampersand);
if (checkampersand > 0)
var replaceampchar = HCTTeamName.replace(..........

Is there anything that I can do the whole name as such if any special
character like this comes? Any help in this regard is great. Please help.

Thanks,

Raja Raman S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070404/2f3ce02e/attachment.htm>


More information about the Javascript mailing list