本文介绍了日期功能在IE8中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下在Chrome中正常运行:
I've got the following which works fine in Chrome:
function funLoad(str1,str3,str4)
{
var dym1 = str1.split("/");
var d=new Date();
var dym2 = d.getMonth() + 1 + " " + d.getDate() + " " + d.getFullYear() + " " + d.getHours() + ":" + d.getMinutes() + ":00";
//var dym2 = "6 10 2013 09:00:00";
var start = Date.parse(dym1[1] + " " + dym1[0] + " " + dym1[2] + " " + str3 + ":" + str4 + ":00");
var end = Date.parse(dym2);
return (start-end) / (1000*60*60);
}
$("#btn1").click(function(event){
alert(funLoad($("#txt1").val(),$("#ddlHourTime").val(),$("#ddlMinuteTime").val()));
});
这是一个jsFiddle:
Here is a jsFiddle:http://jsfiddle.net/oshirowanen/QTVWd/6/
当我跑步时在IE8中,我只是收到 NaN
的提醒。
When I run this in IE8, I just get alerted with NaN
.
推荐答案
看起来IE中不支持该格式
Looks like that format is not supported in IE
var dym2 = d.getMonth() + 1 + "-" + d.getDate() + "-" + d.getFullYear() + " " + d.getHours() + ":" + d.getMinutes() + ":00";
这篇关于日期功能在IE8中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!