Special character validation in Password using Javascript
<pre><code>function SpecialCharacters(e) {
        var keynum
        var keychar
        var numcheck
        // For Internet Explorer
        if (e=window.event) {
            keynum = e.keyCode;
        }
        // For Netscape/Firefox/Opera
        else if (e.which) {
            keynum = e.which;
        }
        keychar = String.fromCharCode(keynum);
        //List of special characters you want to restrict
        if (keychar == "`" || keychar == "&amp;" || keychar == "&lt;" || keychar == "&gt;" || keychar == "," || keychar == "|" || keychar == "?" || keychar == "¬" || keychar == "£" || keychar == "\\") {
            return false;
        } else {
            return true;
        }
    }
</code></pre>
