校验正则表达式案例

<input id="a" type="text" onblur="test123();" />

function test123()
        {
            var regx = /^[\u4E00-\u9FA5A-Za-z0-9]+$/
            var value = document.getElementById("a").value
            if(regx.test(value))
            {
                alert(value)
            } else {
                alert("格式错误");
            }   
        }       

 

猜你喜欢

转载自www.cnblogs.com/sjzxs/p/9583444.html