In the development of the small details found, before using the ValidForm verification date input box must be filled, and later found to meet the following conditions can be fulfilled is required, the conditions are as follows:
1. The date has a default value when the page is opened.
My97 DatePicker did not find the default value display function, I wrote 2 common functions to implement:
/* Gets the specified date, returning the specified format as of 2012-12-01
*days-for 0 To get the current time, negative value (such as-1) is the day before the current time of the month and date, positive
*time-specified time (such as 2015-3-5) with days (e.g.-100) for the month of the 100 day before 2015-3-5
*has_hms-indicates whether to include time and seconds, default No
/
function Global_tool_getdate (days,time,has_hms) {
var newdate;
if (days==0) {
var now=new Date ();
var y=now.getfullyear ();
var m=now.getmonth () +1;
M= (m<10? ") 0 "+m:m);
var d=now.getdate ();
D= (d<10? ") 0 "+d:d);
if (HAS_HMS) {
var h=now.gethours ();
H= (h<10? ") 0 "+h:h);
var min=now.getminutes ();
Min= (min<10? ") 0 "+min:min);
var s=now.getseconds ();
s= (s<10? ") 0 "+s:s);
newdate=y+ "-" +m+ "-" +d+ "" +h+ ":" +min+ ":" +s;
}else{
newdate=y+ "-" +m+ "-" +D;
}
}else{
var starttime;
if (time) {
if (HAS_HMS) {
var timearr=time.split ("");
var time_h=timearr[0].split ("-"), Time_e=timearr[1].split (":");
Starttime=new Date (parseint (time_h[0)), parseint (time_h[1]) -1,parseint (time_h[2]), parseint (Time_e[0]), ParseInt ( TIME_E[1]), parseint (Time_e[2]). GetTime ();
}else{
var timearr=time.split ("-");
Starttime=new Date (parseint (timearr[0)), parseint (timearr[1]) -1,parseint (timearr[2]). GetTime ();
}
}else{
Starttime=new Date (). GetTime ();
}
var old=new Date (starttime+24*60*60*1000*days);
var old_y=old.getfullyear ();
var old_m=old.getmonth () +1;
Old_m= (old_m<10? ") 0 "+old_m:old_m);
var old_d=old.getdate ();
Old_d= (old_d<10? ") 0 "+old_d:old_d);
if (HAS_HMS) {
var old_h=old.gethours ();
Old_h= (old_h<10? ") 0 "+old_h:old_h);
var old_min=old.getminutes ();
Old_min= (old_min<10? ") 0 "+old_min:old_min);
var old_s=old.getseconds ();
old_s= (old_s<10? ") 0 "+old_s:old_s);
newdate=old_y+ "-" +old_m+ "-" +old_d+ "" +old_h+ ":" +old_min+ ":" +old_s;
}else{
newdate=old_y+ "-" +old_m+ "-" +old_d;
}
}
return newdate;
}
/* Gets the specified month, returning the specified format such as 2012-12
*months-is 0 for the current year, negative (e.g.-13) for the current first 13 months, positive
*/
Function global_tool_getyearmonth (months) {
var newdate;
var now=new Date ();
var y=now.getfullyear ();
var m=now.getmonth ();
if (months==0) {
m=m+1;
m= (m<10? ") 0 "+m:m);
newdate=y+ "-" +M;
}else{
m=m+months;
var newtime=new Date (y,m);
var new_y=newtime.getfullyear ();
var new_m=newtime.getmonth () +1;
new_m= (new_m<10? ") 0 "+new_m:new_m);
newdate=new_y+ "-" +new_m;
}
return newdate;
}
$ ("#overduedetail_ordermonth"). Val (Global_tool_getdate (-1));//Assignment
2. The empty button of the date pop-up window is hidden.
Add attribute Isshowclear:false in Wdatepicker parameter of onclick to implement Shadow Erase button
Overdue analysis Date: <input type= "text" id= "Overduedetail_ordermonth" value= "" class= "Wdate" size= "" onclick= "Wdatepicker ({ DATEFMT: ' Yyyy-mm-dd ', isshowclear:false,onpicked:function () {Overduedetail_search_click ();}}) " readonly= "ReadOnly"/>
3, text input box is not editable.
Add the attribute readonly= "ReadOnly" to the Inputy element