Ed_P Posted November 20, 2004 Share Posted November 20, 2004 I'm trying to create a simple variable with a value that contains a "\" but the "\" is an escape character in Javascript so how do I do this? For example VAR x = "images\test\new.gif"This gives me an error. If I use %5C for the slash it doesn't convert to \. I can't believe I haven't encountered this before but if I did I've forgotten how to resolve it. Thanks Quote Link to comment Share on other sites More sharing options...
epp_b Posted November 20, 2004 Share Posted November 20, 2004 You escape it VAR x = "images\\test\\new.gif" Ironically, in the text that you chose, both "T" and "N" are escapable characters ("tab" and "newline", respectively) Quote Link to comment Share on other sites More sharing options...
Ed_P Posted November 20, 2004 Author Share Posted November 20, 2004 Yup!! That did it epp_b. Thanks I use the \n and \t to format alerts and I know there are others. I thought I had tried the \\ option and it didn't work but apparently not. Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.