自己整理 可用的 表单验证(表单项不能为空)js自定义trim操作
来源:互联网 发布:tomcat war 部署端口 编辑:程序博客网 时间:2024/06/04 19:28
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
String.prototype.trim = function() { return this.replace(/(^\s+)|(\s+$)/g, ''); }
function check(obj){
if(obj.value.length <=0 ||obj.value.trim()=="") {
document.getElementById("errorinfo").style.display = "block";
document.getElementById("submit").disabled = true;
} else {
document.getElementById("errorinfo").style.display = "none";
document.getElementById("submit").disabled = false;
}
}
</script>
</head>
<body>
<!--
<p style="color:#FF0000" align="center">温馨提示:带"*"为必填内容</p>
-->
<form name="form1" method="post" action="www.baidu.com" >
<table>
<tr>
<td >账号:</td>
<td ><input name="username" type="text" id="username" onblur="check(this)"/>
* <div style="display:none" id="errorinfo"><font color="red">账号不能为空</font></div></td>
</tr>
<tr>
<td >
<input type="submit" value="提交" id="submit" style="width:50px" disabled="disabled"/>
</td>
</tr>
</table>
</form>
</body>
- 自己整理 可用的 表单验证(表单项不能为空)js自定义trim操作
- JS判断提交表单不能为空 等的验证
- 通过JS来验证表单项不能为空
- JavaScript验证表单项不能为空
- js简单表单验证,判断不能为空
- js正则表单验证(trim封装)
- JS验证表单是否为空
- dedecms添加自定义表单判断表单不能为空解决办法
- 织梦自定义表单验证字段不能为空,绝对实用灵活
- 织梦自定义表单验证字段不能为空,绝对实用灵活
- js循环表单验证,不能为空,和一定要输入数字
- 验证表单是否正确——不能为空
- 验证表单内容为空
- 验证表单不为空
- H5表单验证不得为空,自定义提示语
- jquey 验证表单是否存在不能为空(ajax+validattion) .
- js判断表单为空
- JS自定义简陋的表单验证插件
- jQuery基础之jQuery的DOM操作
- Libxml2库的编译和使用
- MemCache
- printf、sprintf、vsprintf的使用取舍
- 解析Android启动脚本init.rc && Android的启动模式
- 自己整理 可用的 表单验证(表单项不能为空)js自定义trim操作
- 如果后台的Activity由于某原因被系统回收了,如何在被系统回收之前保存当前状态?
- 仿微软导航效果,jquery
- Linux下的网络HOOK实现以及使用方法
- rss.xml与atom.xml这两个有什么区别
- cocos2d scheduler 的优势
- 微云获《战神之怒》中国区总代理与chillingo联手打造精品游戏
- MP3文件格式
- 随机颜色矩阵 matlab