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 the event source type
//Get the event type as the judgment condition
var vReadOnly = obj.readOnly;
var vDisabled = obj.disabled;
//Handle the undefined value situation
vReadOnly = (vReadOnly == undefined) ? false : vReadOnly;
vDisabled = (vDisabled == undefined) ? true : vDisabled;
//When the Backspace key is pressed, the event source type is password or single or multi-line text ,
//If the readOnly attribute is true or the disabled attribute is true, the backspace key is invalid
var flag1 = ev.keyCode == 8 && (t == "password" || t == " text" || t == "textarea") && (vReadOnly == true || vDisabled == true);
//When the Backspace key is pressed, the event source type is not password or single or multi-line text, then The backspace key is disabled
var flag2 = ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea";
//Judge
if (flag2 || flag1) return false;
}
//Forbid the back key to work on Firefox and Opera
// document.onkeypress = forbidBackSpace;
//Forbid the back key to work on IE and Chrome
document.onkeydown = forbidBackSpace;