我有以下在 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:http: //jsfiddle.net/oshirowanen/QTVWd/6/
当我在 IE8 中运行它时,我会收到NaN
.