shobhit.mathur@gmail.com wrote:[color=blue]
> Hi!
>
> I have a form with a textarea field. I want to validate the input from
> the textarea using javascript. Suppose I want to check that the user
> has not entered the string:
> "Hello
> World!"
>
> To do this I am using the script:
> form["text"].value == "Hello\nWorld"
>
> But this gives an "unterminated string constant error" because the
> browser converts this to:
> form["text"].value == "Hello
> World"
>
> So how do I do my check?
>
> Regards,
> Shobhit[/color]
This doesn't happen in pure JavaScript.
I'm going to take a wild guess that this line of code is being output
by PHP, PERL, or some similar server-side tongue. In this case, it is
the server-side language that is interpolating the \n.
If this is the case, depending on the language and the way you're
outputing it, you may be able to double-escape it to \\n.