Javascript NaN is appearing on firefox and chrome working only on IE, function for count down time in mins and seconds

I have a javascript function, it shows release time count down in minutes and seconds. as soon as it gets triggered it is starting a count down from 30 minutes onwards, shows mins : seconds.

Working fine in IE, But on firefox and chrome, only seconds part working not minutes.

showing as 

Nan: 59

Nan: 58

minutes part is showing as not a number, can you please kindly help advise what may be the issue.

I am only guessing the part below which is BOLD texted has the issue may be with the browser. Thanks a lot for the helpful info.

function startInterval(locktime)
{
diffsec = 60;

starttime = new Date();
releasetime = new Date();
alerttime = new Date();

//sets the time the record will be released
releasetime.setMinutes(releasetime.getMinutes() + locktime);
//set the time the alert will be fired(95% of the release time)
alerttime.setTime(alerttime.getTime() + locktime*60*1000*0.05);

//calculates the difference between startlocktime and releaselocktime
diffmin = DateDiff(starttime,releasetime,"m",false);
if (isNaN(diffmin)) {
showmin = "AA"
}

//adjusts the minutes to be shown witj 2 digits
if (diffmin < 10) {
showmin = "0" + diffmin;
} else {
showmin = "" + diffmin;
}

var e1 = window.parent.frames[2].document.getElementById("txtRemainingTime")
if (e1!=null) {
e1.value = showmin + ‘:00′;
}

//calls the timer every second
interval = window.setInterval("startLockClock()",1000);
}

Hi Cplusplus,

Thanks for your post.

According to your description, my understanding is that your javascript function works fine on IE, but it don’t work as expected on firefox and chrome. The firefox and chrome are out of our support scope, so I recommend to post your problem in  firefox and
chrome forum.

Thanks for your understanding.

Best Regards,

Fei Han

Leave a Reply