prevent of unicode character in textbox
<p>hi i have some textbox in a form n i wanna one of them can only get symbol number and english character but prevent of unicode like ب or ن orص and ....</p>

<p>i wrote following code but it did not work</p>

<pre><code> $(function () {

        $("#usernametxt").keydown(function (event) {

            if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9) {

            }
            else {

                 if ((event.keyCode &gt;= 48 &amp;&amp; event.keyCode &lt;=90) || (event.keyCode &gt;= 96 &amp;&amp; event.keyCode &lt;= 105))
                 {

                 }

                else {
                    event.preventDefault();
                }
            }

        })

    })
</code></pre>

<p>when i wrote fllowing code all of the text box coulnot get unicode </p>

<pre><code> document.onkeypress = function (evt) {
        evt = evt || window.event;
        var charCode = evt.which || evt.keyCode;
        var charStr = String.fromCharCode(charCode);
        if (/[a-zA-Z0-9-_*() #@ ]/i.test(charStr)) {

        }
        else {
            event.preventDefault();
        }
    };
</code></pre>
