JavaScript Gotcha – Oneliners and hiding code.

Quick JavaScript gotcha, the following one-liner won’t work:

Password: <script language='JavaScript'> <!-- document.writeln(generatepwd()) ; --> </script>

This will, because the code itself is no longer on the same line as the ‘<!–’ or ‘–>’ tags/comment delimiters.

Password: <script language='JavaScript'>
<!--
document.writeln(generatepwd()) ;
--> </script>

Comments are closed.