Although I agree with the CMS that you do it unobtrusively (via lib, like jquery or dojo), here's what works:
<script type="text/javascript"> function parse(a, b, c) { alert(c); } </script> <a href="#x" onclick="parse('#', false, 'xyc"foo');return false;">Test</a>
The reason it's barfs is not because of JavaScript, but because of the HTML parser. He has no idea about the escaped quotes that he rolls around to search for the final quote and finds it and returns it as an onclick function. This is invalid javascript, although you cannot find the error until JavaScript tries to execute this function.
seth Jul 04 '09 at 5:41 2009-07-04 05:41
source share