- http address
- The date and time
- digital
- Character length check
- An input and another input of the comparator (for example: Make sure to enter a password)
- Size comparison (only a relatively symbol)
- Easy expansion, you can easily add their own needs authentication
- Compatibility (ie5,6 firefox, oprea)
- The availability of good, did not use alert () to pop-up prompts
This is used to verify the http address.
- url
- date
- number
- any
- There are two dynamic format beginning with \, \ form controls name must represent the same value with;
- \> Number represents a number greater than, and so on; but no \> so =
maxLength - the maximum length.
Create a front-end learning qun438905713, most in the group are zero-based learners, we help each other, answer each other, and also to prepare a lot of learning materials, welcomed the zero-based junior partner to the exchange. The original application file a calendar input control is omitted here. . .
Total code :
Operation code box
*
vForm1.0beta
- Author: Lei Xiao Bao
- Time: 2006-08-08
- URL: http: //lxbzj.com
- e-mail: [email protected]
- License: LGPL
Function Description:
-
verification:
- http address.
- The date and time
- digital
- Character length check
- An input and another input of the comparator (for example: Make sure to enter a password)
- Size comparison (only a relatively symbol)
-
Feature
- Easy expansion, you can easily add their own needs authentication
- Compatibility (ie5,6 firefox, oprea).
- The availability of good, did not use alert () to pop-up prompts;
Instructions
In use, the need to define a style error message box, the present embodiment is the pattern:div.info { 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);
padding: 5px;
}
Then in the page <head> section add <script type="text/javascript" src="calendar/calendar.js"></script>
, then you can write a function to set the form name, validation rules, and finally add the onload event for the body. function start()
{
vFormvform.form_id = 'form1';
vform.err_class = 'info';
// (obj,required(true/false),dataType,errmsg,minlen,maxlen,rule,patams)
//验证规则,逐条填写
vform.rules.add('frm_name',1,'e-mail','请您按照 [email protected] 的格式输入电子邮件地址。<br /><span style="color:#f00">必填项目</span>');
vform.rules.add('myweb',1,'url','请您按照 http://www.domain.com 的格式输入您的网址。<br /><span style="color:#f00">必填项目</span>');
vform.rules.add('dateinput',0,'date','请按2000-03-05 的格式输入日期。<br /><span style="color:#f00">必填项目</span>');
vform.rules.add('qq',0,'number','这必须是一个整数');
vform.rules.add('least10',10,'any','您必须至少填写10个<br /><span style="color:#f00">必填项目</span>');
vform.rules.add('ok100',1,'any','这里被限制为100个字符<br /><span style="color:#f00">必填项目</span>',100);
vform.init();
}<body onload="start();">