Discussion:
Esacpe apostrophe in function parameters
(too old to reply)
Ron Hinds
16 years ago
Permalink
I have a javascript function that accepts several parameters. One parameter
is the name of a business. The problem is, some business' names have an
apostrophe in them, e.g., Mike's Coffee Shop. I get a script error when a
name is passed in that fashion. How do I pass an apostrophe in a parameter?
I could just remove the apostrophe, but I would rather not do that.

Example:

<input type="button" id="next" onclick="navNext('Page.asp', 'Mike's Coffee
Shop');" value="Next">

The parameters are inserted by ASP variables, e.g., 'Mike's Coffee Shop'
would be '<%CustomerName%>'
Igor Tandetnik
16 years ago
Permalink
Post by Ron Hinds
I have a javascript function that accepts several parameters. One
parameter is the name of a business. The problem is, some business'
names have an apostrophe in them, e.g., Mike's Coffee Shop. I get a
script error when a name is passed in that fashion. How do I pass an
apostrophe in a parameter?
'Mike\'s Coffee Shop'
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Ron Hinds
16 years ago
Permalink
...
Thanks, worked great!

Loading...