JS judgment effective time must not be greater than the failure time of ideas and code _javascript skills

Source: Internet
Author: User
Copy code code as follows:

<script type= "text/javascript" >
function Check () {
//start time than end A large time validation
var validtime = Document.form1.validtime.value;
var invalidtime = Document.form1.invalidtime.value;
var begintimes=validtime.substring (0,10). Split ('-');
var endtimes=invalidtime.substring (0,10). Split ('-');
validtime=begintimes[1]+ '/' +begintimes[2]+ '/' +begintimes[0]+ '/' + validtime.substring (10,19);
invalidtime=endtimes[1]+ '/' +endtimes[2]+ '/' +endtimes[0]+ '/' +invalidtime.substring (10,19);
var a = (Date.parse (invalidtime)-date.parse (validtime))/3600/1000;
if (a<0) {
Alert ("The expiration time cannot be less than the effective time!");
return;
}
var emergency = Document.form1.emergency.value;
if (emergency== "" | | Regnull.test (Emergency)) {
Alert ("Please lose urgency!");
Document.form1.emergency.focus ();
return;
}
Document.form1.submit ();
}
<script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.