try
function OK() {
var no = document.form1.telephone.v
no = no.replace("\+","%2B");
window.open("checkphone.as
}
Main Topics
Browse All TopicsI want to send the a telephone number including a "+" (plus) sign to another asp page. So the format of the url will be:
http://mydomain.com/checkp
The no. is typed into a normal textbox and when the user clicks a button the following (simplified) function is called:
function OK() {
var no = document.form1.telephone.v
window.open("checkphone.as
}
If i don't do anything with this, the plus-sign is converted to a space, which is normal, i know. So...
I tried to use escape like this:
var no = escape(document.form1.tele
but escape doesn't convert the plus-sign.
I would really like to solve this without looping through the entire string to check for plus-signs. Any ideas ?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Rather than using escape(), why not use replace() to substitue an alternative string for the + sign. Then, just use the ASP replace() method to convert it back. See below:
function OK() {
var theNo = document.form1.telephone.v
theNo = theNo.replace(/+/g,'PLUS')
window.open("checkphone.as
}
In checkphone.asp, if using VBscript, you might use:
<%
Dim theNo
theNo = request.querystring("no")
theNo = theNo.replace("PLUS","+")
%>
Given that the querystring should contain a telephone number, there shoudln't be a problem with using letters to denote the + sign, should there?
You might want to alter the Javascript regular expression (/+/g), such that it only locates + signs at the beginning of the string.
Business Accounts
Answer for Membership
by: jayaramtPosted on 2002-10-31 at 00:09:25ID: 7391120
You can send a "%2B" instead of a "+". This will always be interpreted as a + when the server reads it.