1.<script type="text/javascript"> 2. function validate(){ 3. var reg = new RegExp("^[0-9]*$"); 4. var obj = document.getElementById("name"); 5. if(!reg.test(obj.value)){ 6. alert("请输入数字!&q
Js代码 <script type="text/javascript"> function SubmitCk() { var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; if (!reg.test($("#txtEmail").val())) { alert("请输入正确邮箱地址&quo
//任意正整数,正小数(小数位不超过2位) var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/; var num = '666.62'; if(isNum.test(num)) { return true; } //验证金额(含零),保留两位小数 var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
<script type="text/javascript"> function validate(){ var reg = new RegExp("^[0-9]*$"); var obj = document.getElementById("name"); if(!reg.test(obj.value)){ alert("请输入数字!"); } if(!/^[0-9]*$/.test(obj.value)){ a