validform表單驗證外掛最終版
阿新 • • 發佈:2019-02-02
做個筆記,以後直接用吧。
報名介面:
- <%@ page language="java"pageEncoding="UTF-8"contentType="text/html;charset=UTF-8"%>
- <%@ include file="/public/taglibs.jsp"%>
- <%@ include file="/public/artDialog.jsp"%>
- <html>
- <head>
- <title>${webname}-報名介面</title>
-
<
- <scripttype="text/javascript"src="/js/common/Data_location.js"></script>
- <scripttype="text/javascript"src="/js/common/Data_folk.js"></script>
- <scripttype="text/javascript"src="/js/common/Data_edu.js"></script>
-
<
- <scripttype="text/javascript"src="/js/My97DatePicker/WdatePicker.js"></script>
- <linkrel="stylesheet"href="/js/jquery/plugins/validform/style.css"type="text/css"media="all"/>
-
<linkrel="stylesheet"
- <styletype="text/css">
- #area_td select {
- width: 115px;
- }
- </style>
- <scripttype="text/javascript">
- //DOM載入完成後即初始化動態資料,代替onload避免圖片載入時的等待
- $(document).ready(function() {
- init();
- });
- function init(){
- getAllDps();
- getAllFolks();
- getAllEducations();
- getAllProvs();//查詢省
- }
- function getAllEducations(){
- for(var index in location_edus){
- var edu = location_edus[index];
- $("#education").append("<optionvalue="+edu.id+">"+edu.n+"</option>");
- }
- }
- function getAllFolks(){
- for(var index in location_folks){
- var folk = location_folks[index];
- $("#folk").append("<optionvalue="+folk.id+">"+folk.n+"</option>");
- }
- }
- function getAllDps(){
- for(var index in location_departs){
- var depart = location_departs[index];
- $("#dp").append("<optionvalue="+depart.id+">"+depart.n+"</option>");
- }
- }
- function getAllProvs(currentcode){
- for(var index in location_provs){
- var prov = location_provs[index];
- $("#prov").append("<optionvalue="+prov.c+">"+prov.n+"</option>");
- }
- }
- function getCitiesByProvCode(currentcode){
- var provcode=$("#prov option:selected").val();
- $("#area").empty();
- $("#area").append("<optionvalue=\"-1\" >請選擇</option>");
- $("#city").empty();
- $("#city").append("<optionvalue=\"-1\" >請選擇</option>");
- for(var index in location_cities){
- var city = location_cities[index];
- if(city.p==provcode){
- var s='';
- if(currentcode==city.c){
- s='selected="selected"';
- }
- $("#city").append("<option "+s+" value="+city.c+">"+city.n+"</option>");
- }
- }
- }
- function getAreasByCityCode(currentcode){
- var citycode=$("#city option:selected").val();
- $("#area").empty();
- $("#area").append("<optionvalue=\"-1\" >請選擇</option>");
- for(var index in location_areas){
- var area = location_areas[index];
- if(area.p==citycode){