zoukankan      html  css  js  c++  java
  • jquery验证邮箱

    jquery验证邮箱
    2010-12-08 17:28

    <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
       
        <title>My JSP 'Email.jsp' starting page</title>
       
     <meta http-equiv="pragma" content="no-cache">
     <meta http-equiv="cache-control" content="no-cache">
     <meta http-equiv="expires" content="0">   
     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
     <meta http-equiv="description" content="This is my page">
     <!--
     <link rel="stylesheet" type="text/css" href="styles.css">
     -->
    <script type="text/javascript" src="JavaScript/jquery-1.4.js"></script>
      </head>
     
      <body>
      <script>
      function check(){
     
       if($("#email1").val()==""){
      
        alert("邮箱不能为空");
        $("#tips").html("不能输入空的");
       return FALSE;
         
       }
       if(!$("#email1").val().match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)){
         alert("格式不正确!请重新输入");
         $("#email1").focus();
        
        
       }
      
        }
     
      </script>
      <form action="#">
      <input type="text" id="email1"><br><span id="tips"></span><br>
      <input type="button" value="提交" onclick="check()">
     
      </form>
     
     
     
      </body>
    </html>

  • 相关阅读:
    浏览器内置对象及其方法
    Leetcode | Path Sum I && II
    Leetcode | 3Sum
    算法分析之渐近符号
    Leetcode | Two Sum
    Leetcode | Wildcard Matching
    LeetCode | Regular Expression Matching
    Leetcode | Subsets I & II
    Leetcode | Populating Next Right Pointers in Each Node I & II
    爱是恒久忍耐,又有恩慈
  • 原文地址:https://www.cnblogs.com/hxwzwiy/p/2418591.html
Copyright © 2011-2022 走看看