Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to replace a character, with it's ASCII equivilant?

Status
Not open for further replies.

tokuzumi

Programmer
Sep 16, 2002
40
US
I have a page that has some text boxes on it, with a description of the text box next to it. Some of those descriptions are hyperlinks, based on certain conditions. When the user clicks on one of the hyperlinks, a popup window comes up, and users can enter more detailed data, regarding that text box. Here is the function;

function NewWindow(URL, varwidth, varheight)
{
var width=varwidth, height=varheight;
//detailsWindow = window.open(URL,'none','width='+width+',height='+height+'');
detailsWindow = window.open(URL,'none','width='+width+',height='+height+',top=0,left=0,scrollbars=yes');

return false;
}

When the user clicks on the link, and the function fires, I bring all the values from the other text boxes into hidden form fields, because when the user updates the information in the popup window, the information they just entered, as well as the information in the other text boxes is saved in our database.

The problem I am running into is with these three comments boxes on the page. Whenever a user enters a "%" sign, the character is stripped out, so "96%" is saved as "96". If a user enters a "#" sign, it only takes what is to the left of the "#" sign. The rest of the text boxes are numeric fields. How can I, using the above function, replace anywhere a "#" or "%" sign is used, to it's ascii equivilant?

Oh, and by the way, the way I put the text box values into the hyperlink is "form.fieldname.value", so I'd use something like this:

NewWindow('pagename.asp?name='+form.name.value+'')

If users do not enter # or %, then I'm fine, but I need to be able to handle these characters. Thanks for any help.
 

should help out _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top