function banBackSpace || window.event;//取得event物件
var obj = ev.target || ev.srcElement //獲取作為判斷條件的事件類型
var vReadOnly = obj.readOnly;
var vDisabled = obj.disabled;
//處理undefined值情況
vReadOnly = (vReadOnly == undefined) ? false : vReadOnly;
//當敲Backspace鍵時,事件來源類型為密碼或單行、多行文本的,
//且readOnly屬性為true或disabled屬性為true的,則退格鍵失效
"password" || t == " text" || t == "textarea") && (vReadOnly == true || vDisabled == true);
退格鍵失效
var flag2 = ev.keyCode == 8 && t != "password" & //判斷
if (flag2 || flag1) return false
}
document.onkeypress = banBackSpace;
//以IE、Chrome
document.onkeydown = banBackSpace;