1.第一种
window.event.returnValue = false;
// return false;
2.第二种
e.preventDefault();
return false;
3. js 正则表达式
$("#btnSels").click(function(e) {
parm = /^[0-9]{0,20}$/;
if (!parm.exec($("#txtWEIGHT0").val())) {
alert("重量請輸入數字!");
e.preventDefault();
return false;
}
});
4.选中
$("#txtZipCode2").focus(function() {
this.select();
})