<script type= "Text/javascript" >
Handling keyboard events prevents back key (Backspace) passwords or single-line, multiline text boxes except
function Forbidbackspace (e) {
var ev = e | | window.event; Get Event Object
var obj = Ev.target | | Ev.srcelement; Get Event Source
var t = Obj.type | | Obj.getattribute (' type '); Get Event Source Type
Gets the event type as a criterion
var vreadonly = obj.readonly;
var vdisabled = obj.disabled;
Handling Undefined value Cases
Vreadonly = (Vreadonly = = undefined)? False:vreadonly;
vdisabled = (vdisabled = = undefined)? true:vdisabled;
When the BACKSPACE key is hit, the event source type is password or single line, multiline text,
And the ReadOnly property is true or the disabled property is true, the BACKSPACE key fails
var Flag1 = Ev.keycode = = 8 && (t = = "password" | | t = = "text" | | t = = "textarea") && (Vreadonly = True | | vdisabled = = true);
When the BACKSPACE key is hit, the event source type is non-password or single-line, multiline text, the BACKSPACE key is invalidated
var Flag2 = Ev.keycode = = 8 && t! = "password" && t! = "text" && t! = "TEXTAREA";
Judge
if (Flag2 | | flag1) return FALSE;
}
Disable Back button action on Firefox, Opera
document.onkeypress = Forbidbackspace;
Disable back key action on IE, Chrome
Document.onkeydown = Forbidbackspace;
</script>
Handling keyboard events prevents back key (Backspace) passwords or single-line, multiline text boxes except