<form action="{:U('Messages/add')}" method="post">
    <div class="secondLevel_regedit">
        <ul>
            免费课程体验
        </ul>
        <ul>
            <li>
                <dl>
                    <select name="province" class="input_border">
                    </select>
                    <select name="xiaoqu" class="input_border">
                    </select>
                    <script type="text/javascript" src="__JS__/xiaoqu.js">
                    </script>
                    <script type="text/javascript">
                        new PCAS("province", "xiaoqu");
                    </script>
                    <input name="phone" type="text" id="tel" class="input_border" placeholder="手机号码">
                </dl>
                <dl>
                    <input name="age" type="text" id="age" class="input_border" placeholder="孩子年龄">
                    <input name="name" type="text" id="name" class="input_border" placeholder="孩子姓名">
                    <input name="email" type="text" id="email" class="input_border" placeholder="电子邮件">
                </dl>
            </li>
            <li>
                <dl>
                    <input name="ys" id="ys" type="checkbox" value="1" checked="checked" />
                    我已阅读并接受
                    <a href="javascript:;" id="readTK">
                        隐私条款
                    </a>
                </dl>
                <dl>
                    <input name="ty" id="ty" type="checkbox" value="1" checked="checked" />
                    我同意收到来自芝麻街英语及其成员校区的活动与优惠信息
                </dl>
            </li>
        </ul>
        <ul>
            <input type="submit" id="submit" value="马上申请" class="nysubmit" />
        </ul>
    </div>
</form>
<script>
    $(function() {
        $("#submit").click(function() {
            var isMobile = /^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/; //手机号码验证规则
            var isPhone = /^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/; //座机验证规则
            var dianhua = $("#tel").val();
            var age = $("#age").val();
            var name = $("#name").val();
            var email = $("#email").val();
            if (dianhua == '') {
                alert('电话不能为空！');
                return false;
            }

            if (!isMobile.test(dianhua) && !isPhone.test(dianhua)) {
                alert("请正确填写电话号码，例如:13415764179或0321-4816048");
                $("#dianhua").focus(); //输入框获得光标
                return false; //返回一个错误，不向下执行
            }
            if (age == '') {
                alert('年龄不能为空！');
                return false;
            }
            if (name == '') {
                alert('姓名不能为空！');
                return false;
            }
            if (email == '') {
                alert('邮件不能为空！');
                return false;
            }
            return true;
        })

    })
</script>