Question : Page crashes when the user press tab key on input box.

Hi, do someone know why the page crashes when the user press tab key while the cursor is on the following input box:
1:
2:
3:
4:
5:
6:
7:
8:
9:
<input type="text" name="fname" onkeypress="return false;"
onkeydown="doCheck();" onpaste="return false;"/>

And here is the doCheck() function:
    function doCheck() {
        var keyCode = (event.which) ? event.which : event.keyCode;
        if ((keyCode == 8) || (keyCode == 46) )
            event.returnValue = false;
 }

Answer : Page crashes when the user press tab key on input box.

try:
1:
2:
3:
4:
5:
6:
7:
8:
9:
<input type="text" name="fname" onkeypress="return false;"
onkeydown="doCheck(event);" onpaste="return false;"/>

    function doCheck(e) {
        e = e ? e : window.event;
        var keyCode = (e.which) ? e.which : e.keyCode;
        if ((keyCode == 8) || (keyCode == 46) )
            e.returnValue = false;
 }
Random Solutions  
 
programming4us programming4us