本文介绍了如何通过Java脚本进行露营的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

var CurrentDate = CurrentDate();
此行消息出现对象预期的
请帮帮我.

var CurrentDate = CurrentDate();
this line message appear object expected
Please help me.

function Check_ToDate(obj) {
           var txtPrevDate = gebi("ctl00_cph1_txtPrevDate");
           gebi('divDate').style.display = "none";
           //obj.className = "unwatermarked";
           //gebi('row').style.display = "block";
           if (gebi(obj).value != "Please type here...") {
               var arrPreDate = gebi(obj).value.split(" ");
               var Date = arrPreDate[1] + " " + arrPreDate[0] + " " + arrPreDate[2];

               var CurrentDate = CurrentDate();
               if (Date.parse(Date) > (Date.parse(CurrentDate))) {
                   gebi('divDate').innerHTML = "<img src='images/error.gif' alt='' />Previous date must not be greater than current date...";
                   gebi('divDate').style.display = "block";
                   obj.className = "unwatermarked_Error";
                   return false;
               }

           }
           return true;
       }

推荐答案


var CurrentDate = new Date();



现在,为了比较两个单独的日期,您可以直接比较两个日期对象,如下面的示例所示



Now for comparing two separate date you can directly compare two date objects just as shown in below example

var x=new Date();
x.setFullYear(2013,03,02);
var today = new Date();
if (x>today)
{
  alert("Today is before 2nd March 2013");
}
else
{
  alert("Today is after 2nd March 2013");
}


这篇关于如何通过Java脚本进行露营的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 11:20