這個程式碼沒什麼,貼上來,我想表達的重點隱藏在程式碼中,找找看! 複製程式碼 代碼如下: -/html/PUBL "IC DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> show date <BR>name="mark"; <BR>function showLastDate() <BR>{ <BR>alert(name); <BR>var reg=/^d{4}/d{1,2}/d{1,2}$/; <BR>var inputdate=$("#indate ").val(); <BR>if(!reg.test(inputdate)) <BR>{ <BR>alert("please input date like:2013/1/14"); <BR>return; <BR>} <BR>var month=parseInt(inputdate.split("/")[1]); <BR>if(month>12||month==0) <BR>{ <BR>alert("please input month range from 1-12"); <BR>return; <BR>} <BR>var showdate=getLastDate(inputdate); <BR>$("#lastdate").val(showdate); <BR>} <BR>} <BR>function getLastDate(indate) <BR>{ <BR>alert(name); <BR>var year=parseInt(indate.split("/")[0]); <BR>var month=parseInt(indate. split("/")[1]); <BR>//run nian <BR>var isrun=false; <BR>if((year%4==0 && year 0!=0)|| year@ 0==0) <BR>isrun=true; <BR>switch(month) <BR>{ <BR>case 2: <BR>if(isrun) <BR>{return 29;} <BR>else <BR>{return 28;} <BR>case 1: <BR>case 3: <BR>case 5: <BR>case 7: <BR>case 8: <BR>case 10: <BR>case 12: <ase >return 31; <BR>default: <BR>return 30; <BR>} <BR>} <BR> input date:example:2013/1/14 input date: