function changeInsSort() {
var policyCode = document.getElementById("inOutAccount.operNumber").value;
//alert("policyCode="+policyCode);
var carRegEx = /^\w{11}(19|20)\d{2}B\d{6}$/;
var unCarRegEx = /^\w{8}(19|20)\d{2}\d{8}$/;
if (carRegEx.test(policyCode)) {
//alert("车险保单");
unCarInsTr.style.display="none";
carInsTr.style.display="";
}else if (unCarRegEx.test(policyCode)) {
//alert("非车险保单");
carInsTr.style.display="none";
unCarInsTr.style.display="";
}
}
注意正规表达式不能用引号引起来,而是用"/^"+正规表达式+"$/"