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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reserve Characters and ZIP Code values 1

Status
Not open for further replies.

tmcneil

Technical User
Nov 17, 2000
294
US
I have a form that retrieves a zip code using Request.Form method. This form has a button that I would like to pass the value of the zip code to a javascript function that will contain a window.open method. The problem is that say if I enter a zip code that starts with a "0", like 04910. Then the "0" is dropped from the value when it goes to the javascript function.

ASP form code
Code:
zipcode = Request.Form("zipcode")

 <input type="submit" value="Yes" onClick="openWin(<%=zipcode%>)" />

javascript call
Code:
function openWin(zip) 
{
    alert("zip: " + zip);
    //window.open("[URL unfurl="true"]http://www.w3schools.com");[/URL]
    /*window.open(<i>URL,name,specs,replace</i>);*/
}

The value shown in the alert box is '4910' instead of 04910. So, is zero a reserve character and how do I make sure that preceeding zeros get passed to javascript?

Todd
 
[tt]<input type="submit" value="Yes" onClick="openWin([highlight]'[/highlight]<%=zipcode%>[highlight]'[/highlight])" />[/tt]
 
tsuji,

That's right, I need a string. Big help since I thought I was going to have to write a lot of code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top