9. //var emailReg = /^[_a-z0-9]+@([_a-z0-9]+\\.)+[a-z0-9]{2,3}$/; 10. var emailReg = /^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/; 11. if( emailReg.test(strEmail) ){ 12. return true; 13. }else{ 14. alert(\您输入的Email地址格式不正确!\ 15. return false; 16. } 17. }
1. /* 2. 用途:检查输入的电话号码格式是否正确 3. 输入: 4. strPhone:字符串 5. 返回: 6. 如果通过验证返回true,否则返回false 7. */ 8. function checkPhone( strPhone ) { 9. var phoneRegWithArea = /^[0][1-9]{2,3}-[0-9]{5,10}$/; 10. var phoneRegNoArea = /^[1-9]{1}[0-9]{5,8}$/; 11. var prompt = \您输入的电话号码不正确!\ 12. if( strPhone.length > 9 ) { 13. if( phoneRegWithArea.test(strPhone) ){ 14. return true; 15. }else{ 16. alert( prompt ); 17. return false; 18. } 19. }else{ 20. if( phoneRegNoArea.test( strPhone ) ){ 21. return true; 22. }else{ 23. alert( prompt ); 24. return false; 25. } 26. } 27. }
1. /* 2. 用途:检查复选框被选中的数目 3. 输入: 4. checkboxID:字符串 5. 返回: 6. 返回该复选框中被选中的数目 7. */ 8. function checkSelect( checkboxID ) { 9. var check = 0; 10. var i=0; 11. if( document.all(checkboxID).length > 0 ) { 12. for( i=0; i
1. /*