in reply to Re: Perl, JavaScript and quoting/escaping
in thread Perl, JavaScript and quoting/escaping

Generally, as long as you keep using the same type of quote, you double the \'s for each nested level, so try:
example.jsfunction('<a href=\'\' onclick=\\'alert(\\\\'test\\\\')\\'>< +/a>')

Replies are listed 'Best First'.
Re^3: Perl, JavaScript and quoting/escaping
by ikegami (Patriarch) on Sep 23, 2008 at 21:00 UTC

    That would only work for if all of JS, HTML and Perl used "\" to escape. HTML doesn't.

    Assuming you had the right number of slashes — you don't — you're code results in the following HTML:

    <a href='' onclick='alert(\' <- Nice JS! test\')' <- eh? ></a>