基于prototype.js验证框架(validation.js)的三个应用
2010-09-14 13:21:50 来源:WEB开发网html代码:
<tdclass="label">CSONumber</td>
<td><inputtype="text"name="csoNumber"id="csoNumber"></td>
<tdclass="label">AgreementNumber</td>
<td><inputtype="text"name="agreementNumber"id="agreementNumber"></td>
<tdclass="label">SequenceNumberNumber</td>
<td><inputtype="text"name="sequenceNumber"id="sequenceNumber"></td>
<tdclass="label">TariffCode</td>
<td><inputtype="text"name="tariffCode"id="tariffCode"></td>
<tdcolspan="6"align="center"><buttonclass="submit"id="search">Search</button></td>
javascript脚本:
window.onload=function(){
应用二:该例子通过ajax结合后台来进行验证
//注册查询按钮事件
Event.observe("search","click",function(){
varvalidator=Validation.get("IsEmpty");
if([$F("csoNumber"),$F("agreementNumber"),$F("sequenceNumber")].all(validator.test)){
["required"].all(Validation.test.bind($("tariffCode")));
} });
更多精彩
赞助商链接