NaN character in IE and firefox

nodar

this is my HTML code:

<ul class="countdown">
  <li class="timer"><div  id="days"></div><H1>Days</H1></li>
  <li class="timer"><div  id="hours"></div><H1>Hours</H1></li>
  <li class="timer"><div  id="mins"></div><H1>Minutes</H1></li>
  <li class="timer"><div  id="secs"></div><H1>Seconds</H1></li>
</ul>

And this is the JS code,

var xmas = new Date("jule 2, 2014 00:01:00");
var now = new Date();
var timeDiff = xmas.getTime() - now.getTime();
if (timeDiff <= 0) {
    clearTimeout(timer);
    document.write("Christmas is here!");
    // Run any code needed for countdown completion here
}
var seconds = Math.floor(timeDiff / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);
hours %= 24;
minutes %= 60;
seconds %= 60;
document.getElementById("days").innerHTML = days;
document.getElementById("hours").innerHTML = hours;
document.getElementById("mins").innerHTML = minutes;
document.getElementById("secs").innerHTML = seconds;
var timer = setTimeout('cdtd()',1000);

The result is working in Chrome but IE and Firefox return NaN.

Winestone

I got it working.

Live example at: http://testnaman.neocities.org/quicktest2.html. This will not be permanent.

You need to change:

var xmas = new Date("jule 2, 2014 00:01:00");

To:

var xmas = new Date("July 2, 2014 00:01:00");

As it seems Firefox doesn't like incorrect spelling.

For more information take a look at: new Date() is working in Chrome but not Firefox.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Javascript Countdown shows NaN in IE and Firefox, works in Chrome

From Dev

Date difference works in Firefox and IE but return NaN in Chrome

From Dev

getComputedStyle() and cssText in IE and Firefox

From Dev

Ionicons not displaying in IE and Firefox

From Dev

Inconsistent display on IE & Firefox

From Dev

scrollTop not working in firefox and IE

From Dev

phantom JS for IE/Firefox

From Dev

JavaScript not working in IE but in Firefox

From Dev

Bouncing scrollbars in IE and Firefox

From Dev

IE/Firefox bubble event

From Dev

Gap in Firefox but not in IE

From Dev

No background in IE and Firefox

From Dev

Prevent fouc in firefox and ie

From Dev

Javascript CountDown showing NaN on firefox

From Dev

Character rendering is different (IE/Chrome)

From Dev

Table dates color in firefox but not in IE

From Dev

:hover property not working on Firefox/IE

From Dev

IE 10 and Firefox issues with phpmyadmin

From Dev

Javascript download not working in Firefox and IE

From Dev

.bind( ) Javascript not working in Firefox & IE?

From Dev

code printing in firefox but not printing in IE

From Dev

Problems with displaying an iframe on firefox/IE

From Dev

Chrome --app equivalent in Firefox\IE

From Dev

Table disappears completely in Firefox and IE

From Dev

The drag event not firing in Firefox or IE

From Dev

CSS code not working in Firefox and IE

From Dev

Trouble With Selection Object in Firefox and IE

From Dev

Jquery code not working on IE and firefox

From Dev

Working fine in IE but not in Firefox and Chrome