扫码添加
客服微信

扫码关注
微信公众号

13950058311

资讯动态

News

——

自定义表单JS 控制必填选项

2017-06-27

<script language='javascript'>
                                function Checkfeedback() {
                                    if (document.myform.name.value.length == 0) {
                                        alert('您的姓名 不能为空');
                                        document.myform.name.focus();
                                        return false;
                                    }
                                    if (document.myform.qq.value.length == 0) {
                                        alert('QQ号码 不能为空');
                                        document.myform.qq.focus();
                                        return false;
                                    }
                                    if (document.myform.email.value.length == 0) {
                                        alert('email 不能为空');
                                        document.myform.email.focus();
                                        return false;
                                    }
                                    if (document.myform.tel.value.length == 0) {
                                        alert('手机 不能为空');
                                        document.myform.tel.focus();
                                        return false;
                                    }
 
                                }
   </script>
 
<form action="http://127.0.0.1/plus/diy.php" method="post"  name='myform' onSubmit='return Checkfeedback();'>