直接上代码

 <form action="${pageContext.request.contextPath}/login/main.do" method="post" id="loginform" >
<div class="login_content">
<div id="showError" class="errorContainer" style=" padding-top: 0px;margin-bottom: -24px;display:none;">
   <img src="${pageContext.request.contextPath}/images/command_failed.png" id="errorImg" style="margin-top:-2px;margin-right:5px;"/>
  <span id="erroMessage"></span>
</div>
<div class="input_box" >
<span class="sp_text">用户名:</span>
                      <input type="text" id="username" name="name" maxlength="50" AUTOCOMPLETE="off" required="required" oninvalid="setCustomValidity('用户名不能为空,请输入')" oninput="setCustomValidity('')"/>
</div>
<div class="input_box">
<span class="sp_text">密码:</span>
                      <input type="password" id="password" name="password" maxlength="50" AUTOCOMPLETE="off" required="required" oninvalid="setCustomValidity('warning')" oninput="setCustomValidity('')"/>
</div>
<div id="advance_text" style="display: none;">
<div class="input_box" >
<span class="sp_text">认证模式:</span>
<select class="text" name="" style="width: 143px">
<option value="0" style="color: #333">普通用户</option>
</select>
</div>
</div>
<div class="input_box">
<!-- <span class="i_button_text">
<a class="i_button_input" href="javascript:loginValidate()">登录</a>
</span> -->
<button class="button button-raised button-box button-jumbo button-small button-pill"><i class="fa fa-thumbs-up">登录</i></button>
<span>
<a href="javascript:advance();" class="i_button_input advanceBtn_nomal" id="advanceBtn" >高级</a>
</span> </div> </div>
</form>

js代码

$(function() {
document.getElementById('username').focus();
$('#username').bind("focus",cleanError);
$('#password').bind("focus",cleanError);
$('#erroMessage').bind('change',noneOrblockImg); $("#loginform").bind("submit",loginform) });
function loginform(){//检查用户输入信息格式是否正确 $("#erroMessage").text("登录中..."); $.ajax({
url:"loginValidate.do",
type:'post',
data:{"name":name,"password":pwd},
dataType:'json',
success:function(data) {
if(data.state==0) { $("#loginform").submit();
} else{ $("#erroMessage").text(data.message);
return false;
}
},
error:function(data){
//console.log(data); }
});
}

最后推荐一个专做按钮的开源网站

http://www.bootcss.com/p/buttons/

使用html5中required属性的更多相关文章

  1. HTML5中meta属性大集合

    1.声明文档的字符编码 <meta charset='utf-8'> 2.声明文档的兼容模式 <meta http-equiv="X-UA-Compatible" ...

  2. [转] HTML5中meta属性的使用详解

    meta属性在HTML中占据了很重要的位置.如:针对搜索引擎的SEO,文档的字符编码,设置刷新缓存等.虽然一些网页可能没有使用meta,但是作为正规军,我们还是有必要了解一些meta的属性,并且能够熟 ...

  3. IE9对HTML5中一部分属性不提供支持的原因

    为什么在IE9中对于HTML5标准中的离线应用程序以及CSS3中的一部分不提供支持?笔者间接了解到了这个原因. 微软日前已经发布了Internet Explorer 9(以下简称IE9)正式版.在该版 ...

  4. HTML5中meta属性

    meta属性在HTML中占据了很重要的位置.如:针对搜索引擎的SEO,文档的字符编码,设置刷新缓存等.虽然一些网页可能没有使用meta,但是作为正规军,我们还是有必要了解一些meta的属性,并且能够熟 ...

  5. HTML5中meta属性的使用详解

    meta属性在HTML中占据了很重要的位置.如:针对搜索引擎的SEO,文档的字符编码,设置刷新缓存等.虽然一些网页可能没有使用meta,但是作为正规军,我们还是有必要了解一些meta的属性,并且能够熟 ...

  6. 详解HTML5中rel属性的prefetch预加载功能使用

    在HTML5中,有个很有用但常被忽略的特性,就是预先加载(prefetch),它的原理是: 利用浏览器的空闲时间去先下载用户指定需要的内容,然后缓存起来,这样用户下次加载时,就直接从缓存中取出来,效率 ...

  7. html5中contenteditable属性如果过滤标签,过滤富文本样式

    ​​在div中使用contenteditable=”true”可以达到模拟输入框的效果,但是当我们复制其他网页内容进去的时候,会发现连带的样式也一起复制进去了.很明显我们不需要复制富文本样式,那么如何 ...

  8. 解决HTML5中placeholder属性兼容性的JQuery插件

    //调用方法 $(function () {   $(".pHolder").jason(); }); //HTML代码 <input type="text&quo ...

  9. html5中的选择器

    1.html5中的属性选择器 <body> <style type=text/css> <!--1>完全匹配选择器--> [id=test]{ color:r ...

随机推荐

  1. docker--docker 容器操作

    6 docker 容器操作 容器是 docker 镜像的运行时实例. 6.1 创建容器 docker run [options] image command [ARG...]options选项: ‐i ...

  2. 转 appium grid分布式环境搭建

    https://blog.csdn.net/ljl6158999/article/details/80803239 说起grid,了解selenium的人肯定知道,他就是分布式的核心.原理是简历中心h ...

  3. golang网络编程高并发

    1 golang写服务器不需要epoll吗 golang写服务器不需要在用reactor模式的epoll了,因为golang的协程非常廉价,可以并发开启成千上完个协程. 一个协程占用内存大概2KB左右 ...

  4. MySql-Mysql技术内幕~SQL编程学习笔记(N)

    1._rowid 类似Oracle的rowid mysql> ; +-------+----+----------------+-------------+---------------+--- ...

  5. P1536村村通

    这是一个并查集的题,被洛谷评为提高—. 拿到这个题便看出了这是一个裸的并查集,于是就写了一个模板,结果发现连输入都输不进去,一看竟然是多组数据,,然后看到N==0结束,于是便加了一层while.之后提 ...

  6. P2218 [HAOI2007]覆盖问题

    传送门 首先可以想到二分答案,然后考虑判断 注意到所有点的外包矩形的四条边一定要被覆盖到,而正方形只有 $3$ 个,所以一定有一个正方形在角落 考虑爆搜,枚举正方形在当前外包矩形的那个角,然后对剩下的 ...

  7. PyTorch环境配置及安装

    环境配置 温馨提示:为了更好的教程体验,提供视频.阅读地址 Youtube: https://www.youtube.com/playlist?list=PLgAyVnrNJ96CqYdjZ8v9Yj ...

  8. spring通过注解转换日期

    Spring中有@DataTimeFormat和@JsonFormat @JsonFormat不要忘了加GMT+8 @DateTimeFormat要注意前台传过的日期格式是yyyy-MM-dd的形式, ...

  9. hdu4731 Minimum palindrome (找规律)

    这道题找下规律,3个字母或者以上的时候就用abcabcabc....循环即可. 一个字母时,就是aaaaa.....; 当只有2个字母时!s[1][]=a"; s[2][]="ab ...

  10. pymysql基本操作

    https://www.cnblogs.com/woider/p/5926744.html https://www.runoob.com/python3/python3-mysql.html 注意: ...