-
retrieving String value using scriptlet within js code (1 messages)
- Posted by: m m
- Posted on: November 02 2008 06:13 EST
Hello- A js error "unterminated string literal" occurs when writing the following lines alert('<%=x%>'); while it doesn't when using a pure js code like the following var x = "x\ny"; alert(x); can anybody help? thank youThreaded Messages (1)
- Escape your newline by Brandon India on November 02 2008 12:44 EST
-
Escape your newline[ Go to top ]
- Posted by: Brandon India
- Posted on: November 02 2008 12:44 EST
- in response to m m
If you view source in your browser, you will likely see that the java newline gets rendered into the html, causing invalid javascript. If you escape the backslash on your newline, it will likely work. alert('<%=x%>');