栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > JavaScript

JavaScript表单验证的两种实现方法

JavaScript 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

JavaScript表单验证的两种实现方法

本文实例为大家分享了js表单验证的实现方法,供大家参考,具体内容如下

第一种:js表单验证




  
  注册-个人用户
  
  
  
  
  
    body {
      font-family: Arial, "宋体", Lucida, Verdana, Helvetica, sans-serif;
      font-size: 12px;
      color: #333;
      line-height: 150%;
      background: #f2f2f2;
    }

    .hide{display:none;}

    .focus,.error {
      color: #e4393c;
      line-height: 36px;
      height: 36px;
      position: absolute;
      top: 0px;

      width: 260px;
      padding: 0 5px;
      background: #FFEBEB;
      border: 1px solid #ffbdbe;
    }

    .error span,.focus span {
      padding: 5px 0;
      line-height: 13px;
      display: block;
    }

    .focus {
      color: #666;
      width: 260px;;
      line-height: 36px;
      background: #f7f7f7;
      border: 1px solid #dddddd;
    }

    .regist {
      width: 990px;
      padding: 0;
      margin: 0 auto;
      zoom: 1;
    }


    .mc {
      padding: 30px 0 20px;
      border: solid #dddddd; border-width : 0px 1px 1px;
      background: #FFF;
      overflow: hidden;
      zoom: 1;
      border-width: 0px 1px 1px;
    }

    .form {
      float: left;
      width: 750px;
      font-size: 12px;
    }

    .form label,.form input,.form select,.form textarea,.form button,.form .label {
      float: left;
      font-size: 12px;
    }

    .item {
      padding-top: 9px;
      height: 60px;
      line-height: 34px;
      position: relative;
      z-index: 1;
    }

    .label {
      float: left;
      width: 190px;
      text-align: right;
      font-size: 14px;
      color: #999;
      padding-right: 10px;
    }

    .input {
      float: left;
      position: relative;
      width: 270px;
      overflow: visible;
    }

    .text {
      float: none;
      width: 275px;
      height: 37px;
      line-height: 32px;
      border: 1px solid #cccccc;
      font-size: 14px;
      font-family: arial, "宋体";
      overflow: hidden;
    }

  


   
    
      
      
  


   


第二种:



  
    
    
    
    
      * {
 padding: 0;
 margin: 0;
      }

      form {
 width: 570px;
 height: 300px;
 margin: 100px auto;
      }

      label {
 width: 64px;
 float: left;
 clear: left;
 height: 36px;
 line-height: 36px;
 margin-top: 10px;
      }

      input {
 width: 300px;
 height: 36px;
 line-height: 36px;
 margin-top: 10px;
 text-indent: 8px;
 font-size: 16px;
 font-family: "微软雅黑";
 border: 1px solid #ccc;
 float: left;
      }

      #sub {
 width: 302px;
 height: 40px;
 border: 1px solid #ccc;
 background: #888;
 color: #fff;
 font-size: 18px;
 text-indent: 0;
      }

      .spa {
 height: 36px;
 line-height: 36px;
 width: 204px;
 display: inline-block;
 float: left;
 font-size: 12px;
 color: #BD362F;
 text-indent: 10px;
 margin-top: 10px;
      }
    
  

  
    
    
    
  

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/90197.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号