Stripping out < and > in javascript doesn't quite work
<pre><code>    function SanitizeInput(input) {



        input = input.replace(/&lt;/g, "&amp;lt;");
        input = input.replace(/&gt;/g, "&amp;gt;");


        return input;
    }

document.write(SanitizeInput("Test!&lt;marquee&gt;bibble&lt;/marquee&gt;"));
</code></pre>

<p>If you pop this into jsfiddle.net the result is <code>Test!&lt;marquee&gt;bibble&lt;/marquee</code> without the trailing ></p>

<p>Can anyone explain what I'm doing wrong?</p>

<p>Edit: Replacing it with ( and ) seems to work perfectly</p>
