What you want to do is first escape the back slash, then escape the apostraphe...
so you want to have a string that looks like this: var name = '\\\'';
That should get what you are looking for. you may need to create a string parsing or regular expression routine to get what you are looking for.
Richard Norman Web/Application Developer
----Original Message Follows---- From: "Koes, Derrick" <[EMAIL PROTECTED]> Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Subject: escaping problems--ha! Date: Wed, 10 Sep 2003 16:59:24 -0400
My scenario involves a user who wishes to enter \' in an html input field. I must then convert that to a javascript variable (for any number of reasons). However, when I attempt to escape backslashes then attempt to escape apostrophes, I end up with a javascript error: Unterminated string constant. I can see the source on my page has the javascript variable something like: var name = '\\''. What are the correct steps to correctly escape data such as \' or any number of backslashes or apostrophes.
Thanks, Derrick
_________________________________________________________________
Get 10MB of e-mail storage! Sign up for Hotmail Extra Storage. http://join.msn.com/?PAGE=features/es
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]