//获取今天的日期和时间
var myDate = new Date();
var year = myDate.getFullYear(); //年
var month = myDate.getMonth() + 1;//月
var date = myDate.getDate();//日
var h = myDate.getHours(); //当前时(0-23)
var m = myDate.getMinutes(); //当前分(0-59)
var s = myDate.getSeconds();//当前秒(0-59)
//获取明天的日期
var tomorrow = new Date();
tomorrow.setTime(tomorrow.getTime() + 24*60*60*1000);
tomorrow_month = tomorrow.getMonth()+1;//月
tomorrow_date = tomorrow.getDate();//日
//获取当前时间戳
var now_timestamp = myDate.getTime();
//获取指定时间的时间戳
var time = new Date( year, myDate.getMonth(), date, h, m, s);
var timestamp = time.getTime()
//比较两个时间的大小(先后)
if(now_timestamp > timestamp){
alert('当前时间大');
}