<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "1/DTD/xhtml1-transitional.dtd";>
<html xmlns="";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>vForm表单验证程序</title>
<style type="text/css">
<!--
{
width: 170px;
overflow:visible;
height:auto;
font-size: small;
position: absolute;
background-color: #FFffdd;
border: 1px solid #000;
filter:progid:DXImageTransform.Microsoft.Shadow(color=#111111,direction=135,strength=3);
top: 375px;
padding: 5px;
left: 671px;
}
_title
.err{
padding: 5px;
height: 50px;
width: 24em;
position: absolute;
background-color: #FFFFCC;
left: 196px;
top: 114px;
font-size: small;
opacity:0.5;
border: 1px double #333333;
filter: Shadow(Color=#000000, Direction=135);
filter:progid:DXImageTransform.Microsoft.Shadow(color=#111111,direction=135,strength=5);
}
#form1 .text_input {
border-top: 1px solid #333333;
border-right: 1px solid #999999;
border-bottom: 1px solid #ddd;
border-left: 1px solid #000000;
}<_title {
color: #FF0000;
background: #ACB9D1;
}
#form1 {
position: static;
left: 581px;
top: 463px;
border: 1px solid #3300FF;
padding: 5px;
;
}
#imok {
display: block;
position: absolute;
height:315px;
overflow:scroll;
left: 100px;
top: 100px;
width: 306px;
}
.title h1 {
background: #33CCFF;
border-bottom: medium solid #3366FF;
}
.title p {
font-size: medium;
text-indent: 2em;
}
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: medium;
}
code {
font: 12px/18px "lucida Grande", verdana, lucida, Arial, helvetica, "宋体", sans-serif;
border:1px solid #0099cc;
padding:5px;
margin: 5px;
width: 80%;
color: #000;
background-color: #ddedfb;
display: block;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
//程序基本思路:通过扩展对象来实现,将String扩展 将默认的表单元素扩展 定义两个自定义对象。
//String.isEmail
//String.isUrl
//表单元素.required
//表单元素.isvalid
//表单元素.validate
//
//字符串验证扩展
//├电子邮件验证
String.prototype.isEmail = function(){
var tmpStr = this;
var email = /^w+([-+.]w+)[email protected]+([-.]w+)*.w+([-.]w+)*$/;
return email.test(tmpStr)
}
//├http地址验证
String.prototype.isUrl = function(){
var url = ///[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&_~`@[]':+!]*([^<>""])*$/;
var tmpStr = this;
return url.test(tmpStr);
}
//├日期验证(第一部分)
String.prototype.isDateTime = function(){
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
新闻热点
疑难解答