车牌号正则表达式:<input datatype="/^[u4e00-u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$/">
JS:
window.document.getElementById('wagonNumber').onblur = function () {
var re =/^[u4e00-u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$/;
if(window.document.getElementById('wagonNumber').value.search(re)=='-1'){
alert('请输入正确的车牌号,英文字母大写');
document.getElementById('wagonNumber').value='';
return false;
}
}
只能输入数字:<input type="text" name="data" id="cardNumber" onkeyup="value=value.replace(/[^d]/g,'')" placeholder="请输入卡号"/>