1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| <?php
require_once(’vform.php’); $config = array( array(”,’username’,’require’,’请输入帐号’), array(’len’,’username’,’10′,’帐号不能超过10位’,’5′,’帐号不能少于5位’), array(”,’pass’,’require’,’请输入密码’), array(’len’,’pass’,’16′,’密码不能超过16位’,’6′,’密码不能少于6位’), array(’s’,’repass’,’pass’,’两次输入的密码必须相同’), array(”,’qq’,’number’,’QQ号码必须为数字’), array(’len’,’qq’,’9′,’QQ号码不能超过9位’,’5′,’QQ号码不能少于5位’), array(”,’phone’,’phone’,’电话号码由-和数字组成’), array(”,’name’,’chinese’,’姓名必须是汉字’), array(’len’,’name’,’4′,’这里不欢迎日本人’,’2′,’名字太短了’), array(”,’ename’,’english’,’英文名必须是英文’), array(’len’,’name’,’25′,’你是火星人么?’,’2′,’名字太短了’), array(”,’age’,’number’,’年龄要是数字才行’), array(”,’postcode’,’postcode’,’这个是邮政编码’), array(”,’p’,’percent’,’一个百分比’), array(”,’f’,’float’,’一个有理数,正负小数整数等等’), array(”,’nc’,’nochinese’,’不能输入汉字’), ); $config2 = array( array(”,’username2′,’require’,’请输入帐号2′), array(”,’pass2′,’require’,’请输入密码2′), array(’s’,’repass2′,’pass2′,’两次输入的密码2必须相同’) ); $vform = new vform($config, ‘form1′); $xform = new vform($config2, ‘b_2′, ‘click’); ?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“> <html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <title>vForm示例</title> <style type=”text/css”> *{ margin:0; } body,html{ font:12px; text-align:center; } h1{ font:36px; font-weight:bold; text-align:left; background:#ccc; border-bottom:2px solid #666; margin-bottom:10px; } form{ margin:10px; } img{ border:0; } #main{ width:275px; margin:0 auto; text-align:left; } #main p{ text-align:right; padding:2px; } .text{ width:150px; background:#eee; border:1px solid #666; } .botton{ width:75px; color:#fff; font-weight:bold; background:#555; border:1px solid #000; padding:2px; } </style> <?=$vform->p();?> <?=$xform->p(true);?> </head> <body> <h1>vForm示例</h1> <div id=’main’> <form action=’http://www.m4ker.net’ method=’get’ id=’form1′ > <p><b>帐号:</b><input name=’username’ class=’text’ id=’username’ /></p> <p><b>密码:</b><input name=’pass’ class=’text’ id=’pass’ /></p> <p><b>重复密码:</b><input name=’repass’ class=’text’ id=’repass’ /></p> <p><b>电话号码:</b><input name=’phone’ class=’text’ id=’phone’ /></p> <p><b>QQ号码:</b><input name=’qq’ class=’text’ id=’qq’ /></p> <p><b>姓名:</b><input name=’name’ class=’text’ id=’name’ /></p> <p><b>英文名:</b><input name=’ename’ class=’text’ id=’ename’ /></p> <p><b>年龄:</b><input name=’age’ class=’text’ id=’age’ /></p> <p><b>邮政编码:</b><input name=’postcode’ class=’text’ id=’postcode’ /></p> <p><b>百分比:</b><input name=’p’ class=’text’ id=’p’ /></p> <p><b>有理数:</b><input name=’f’ class=’text’ id=’f’ /></p> <p><b>非汉字:</b><input name=’nc’ class=’text’ id=’nc’ /></p>
<p><input type=’submit’ value=’验证’ class=’botton’ id=’b_1′ /></p> </form> <form action=’http://www.m4ker.net’ method=’get’ id=’form2′ > <p><b>帐号2:</b><input name=’username’ class=’text’ id=’username2′ /></p> <p><b>密码2:</b><input name=’pass’ class=’text’ id=’pass2′ /></p> <p><b>重复密码2:</b><input name=’repass’ class=’text’ id=’repass2′ /></p>
<p><input type=’submit’ value=’验证’ class=’botton’ id=’b_2′ /></p> </form> <p><a href=”http://validator.w3.org/check?uri=referer”><img src=”http://www.w3.org/Icons/valid-xhtml10” alt=”Valid XHTML 1.0 Transitional” height=”31″ width=”88″ /></a></p> </div> </body> </html>
|