// JavaScript Document function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 12) { // check month range //alert("Month must be between 1 and 12."); return false; } if (day < 1 || day > 31) { //alert("Day must be between 1 and 31."); return false; } if ((month==4 || month==6 || month==9 || month==11) && day==31) { //alert("Month "+month+" doesn't have 31 days!") return false } if (month == 2) { // check for february 29th var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); if (day>29 || (day==29 && !isleap)) { //alert("February " + year + " doesn't have " + day + " days!"); return false; } } return true; // date is valid } function MM_validateForm() // function syntax: MM_validateForm('Field1_Name','Message1','ValidType1','Field2_Name','Message2,'ValidType2',....) // FieldName ... Name of field in HTML source // Message ... Name of field for error displaying // ValidType ... T - text field // isEmail - e-mail field // isDate - date field // empty - number field // inRange 1:9 - number range field (min:max) { var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); vlen=val.length; if (val) { nm=args[i+1]; ckv=val.value; if (vlen>0) { if (val.type == "select-one") { if (val.selectedIndex == 0) errors+='- '+nm+' - some value must be selected.\n'; } else { if (val.type == "select-multiple") { if (val.selectedIndex == -1) errors+='- '+nm+' - some value must be selected.\n'; } else { check=''; for(var k=0;k