1. 程式人生 > >validform表單驗證外掛最終版

validform表單驗證外掛最終版

做個筆記,以後直接用吧。

報名介面:

  1. <%@ page language="java"pageEncoding="UTF-8"contentType="text/html;charset=UTF-8"%>
  2. <%@ include file="/public/taglibs.jsp"%>
  3. <%@ include file="/public/artDialog.jsp"%>
  4. <html>
  5.     <head>
  6.         <title>${webname}-報名介面</title>
  7.         <
    %@ include file="/public/meta.jsp"%>
  8.         <scripttype="text/javascript"src="/js/common/Data_location.js"></script>
  9.         <scripttype="text/javascript"src="/js/common/Data_folk.js"></script>
  10.         <scripttype="text/javascript"src="/js/common/Data_edu.js"></script>
  11.         <
    scripttype="text/javascript"src="/js/common/Data_depart.js"></script>
  12.         <scripttype="text/javascript"src="/js/My97DatePicker/WdatePicker.js"></script>
  13.         <linkrel="stylesheet"href="/js/jquery/plugins/validform/style.css"type="text/css"media="all"/>
  14.         <linkrel="stylesheet"
    href="/css/index.css"type="text/css"media="all"/>
  15.         <styletype="text/css">
  16. #area_td select {  
  17.     width: 115px;  
  18. }  
  19. </style>
  20.         <scripttype="text/javascript">
  21.         //DOM載入完成後即初始化動態資料,代替onload避免圖片載入時的等待  
  22.         $(document).ready(function() {  
  23.             init();  
  24.         });       
  25.         function init(){  
  26.             getAllDps();  
  27.             getAllFolks();  
  28.             getAllEducations();  
  29.             getAllProvs();//查詢省  
  30.         }  
  31.         function getAllEducations(){  
  32.             for(var index in location_edus){  
  33.                 var edu = location_edus[index];  
  34.                 $("#education").append("<optionvalue="+edu.id+">"+edu.n+"</option>");  
  35.             }  
  36.         }  
  37.         function getAllFolks(){  
  38.             for(var index in location_folks){  
  39.                 var folk = location_folks[index];  
  40.                 $("#folk").append("<optionvalue="+folk.id+">"+folk.n+"</option>");  
  41.             }  
  42.         }  
  43.         function getAllDps(){  
  44.             for(var index in location_departs){  
  45.                 var depart = location_departs[index];  
  46.                 $("#dp").append("<optionvalue="+depart.id+">"+depart.n+"</option>");  
  47.             }  
  48.         }  
  49.         function getAllProvs(currentcode){  
  50.             for(var index in location_provs){  
  51.                 var prov = location_provs[index];  
  52.                 $("#prov").append("<optionvalue="+prov.c+">"+prov.n+"</option>");  
  53.             }  
  54.         }  
  55.         function getCitiesByProvCode(currentcode){  
  56.             var provcode=$("#prov option:selected").val();  
  57.             $("#area").empty();    
  58.             $("#area").append("<optionvalue=\"-1\" >請選擇</option>");  
  59.             $("#city").empty();    
  60.             $("#city").append("<optionvalue=\"-1\" >請選擇</option>");  
  61.             for(var index in location_cities){  
  62.                 var city = location_cities[index];  
  63.                 if(city.p==provcode){  
  64.                     var s='';  
  65.                      if(currentcode==city.c){  
  66.                         s='selected="selected"';  
  67.                      }  
  68.                     $("#city").append("<option "+s+" value="+city.c+">"+city.n+"</option>");  
  69.                 }  
  70.             }  
  71.         }   
  72.         function getAreasByCityCode(currentcode){  
  73.             var citycode=$("#city option:selected").val();  
  74.             $("#area").empty();    
  75.             $("#area").append("<optionvalue=\"-1\" >請選擇</option>");  
  76.             for(var index in location_areas){  
  77.                 var area = location_areas[index];  
  78.                 if(area.p==citycode){