Effect: forming date-age = Required Test date!
Event:
Triggers the event after changing the formed date text box!
Triggers an event when the Age text box is changed!
Code:
(Note: Molding date ID:TBCXRQ age ID:TBLQ requirements Test date ID:TBYQSYRQ)
Copy Code code as follows:
<script type= "Text/javascript" >
$ (function () {
$ ("#<%=tbcxrq.") ClientID%> "). Change (function () {cacldate ();});
$ ("#<%=tblq.") ClientID%> "). Change (function () {cacldate ();});
Calculate the test time according to the age period
function Cacldate () {
if ($ ("#<%=tblq.") ClientID%> "). val () =" "| | $ ("#<%=tbcxrq.") ClientID%> "). val () =" ") {
$ ("#<%=tbyqsyrq.") ClientID%> "). Val (" ");
}
else {
var moldingdate = $ ("#<%=tbcxrq.") ClientID%> "). Val ();
Moldingdate = Moldingdate.replace ("-", "/")
var d = new Date (moldingdate);
var agedate = $ ("#<%=tblq.") ClientID%> "). Val ();
D.setdate (d.getdate () + parseint (agedate));
var month = D.getmonth () + 1;
if (parseint (month) < 10)
month = "0" + month;
var day = D.getdate ();
if (parseint (day) < 10)
Day = "0" + day;
var date = (D.getfullyear ()) + "-" + month + "-" + day;
$ ("#<%=tbyqsyrq.") ClientID%> "). Val (date);
}
}
});
</script>