C# Web程序,想屏蔽Backspace
$(document).live("onkeydown",function (e) {
var target = e.target;
var tag = e.target.tagName.toUpperCase();
if (e.keyCode == 8) {
if ((tag == 'INPUT' && !$(target).attr("readonly")) || (tag == 'TEXTAREA' && !$(target).attr("readonly"))) {
if ((target.type.toUpperCase() == "RADIO") || (target.type.toUpperCase() == "CHECKBOX")) {
return false;
} else {
return true;
}
} else {
return false;
}
}
});
登录后,打开页面,直接点击Backspace时,页面仍返加上一页面。但点击编辑,在输入框时输入,再进入浏览状态,就不返回了,请问是什么原因,如何避免?
$(document).live("onkeydown",function (e) {
var target = e.target;
var tag = e.target.tagName.toUpperCase();
if (e.keyCode == 8) {
if ((tag == 'INPUT' && !$(target).attr("readonly")) || (tag == 'TEXTAREA' && !$(target).attr("readonly"))) {
if ((target.type.toUpperCase() == "RADIO") || (target.type.toUpperCase() == "CHECKBOX")) {
return false;
} else {
return true;
}
} else {
return false;
}
}
});
登录后,打开页面,直接点击Backspace时,页面仍返加上一页面。但点击编辑,在输入框时输入,再进入浏览状态,就不返回了,请问是什么原因,如何避免?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货