Skip to main content
Inspiring
November 3, 2009
Question

Escaping dynamic Javascript

  • November 3, 2009
  • 1 reply
  • 599 views

Hi,

I've trying to use a tooltip to display a paragrpah of text:

onmouseover="Tip('#comments#')"

The text has html formatting and I get the below error:

Error: unterminated string literal

Line: 1, Column: 4
Source Code:
Tip('<h3>Aim</h3>

Can anyone help?

Many thanks

    This topic has been closed for replies.

    1 reply

    Inspiring
    November 3, 2009

    Check the conversion functions section of the documentation. IIRC there are at least two used to properly escape strings to javascript acceptable format. The names may not be exact, but check for ToScript() and/or JSScriptFormat()