<script type="text/javascript">
var leyou = document.getElementById('J-leyou'),
_name = document.getElementById('J-name'),
mobile = document.getElementById('J-mobile'),
email = document.getElementById('J-email'); leyou.onsubmit = function() {
console.log(_name.value);
if (_name.value === '') {
alert('昵称不能为空');
return false;
} if (mobile.value === '') {
alert('手机号码不能为空');
return false;
} else if (mobile.value.length < 11 || !/^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}$/.test(mobile.value)) {
alert('手机号码格式不正确,请重新填写。');
return false;
} if (email.value === '') {
alert('E-mail 不能为空');
return false;
} else if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(email.value)) {
alert('E-mail 格式不正确,请重新填写。');
return false;
}
};
</script>