• Status: Solved
• Priority: Medium
• Security: Public
• Views: 167

# JavaScript with IE Browser

This script works beautifully on broswer platforms that are not IE. (even my blackberry). It is probably something that only needs another set of eyes.  Deadline is past so I am giving 500 points if you can solve it.
``````<SCRIPT>
var tick;
function stop() {
clearTimeout(tick);
}
function simpleClock() {
var yr = 2009;
var m = 9;
var d = 30;
var forecast = 17118000000;
//change the text below to reflect your own,
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var dayarray = new Array(31,28,31,39,31,30,31,31,30,31,30,31);

var today=new Date();

var todayy = today.getFullYear();
// getMonth is from 0 - 11
var todaym=today.getMonth() + 1 ;
var todayd=today.getDate();

var todayH=today.getHours();
hoursleft = 23 - todayH;

var todayMin=today.getMinutes();
minleft = 59 - todayMin;

///var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+ yr;
// days left in this month
var daysleft = dayarray[todaym] - todayd;

//seconds left
var todays = 59 - today.getSeconds();

//days left in this year
for (var i=todaym; i<m; i++)
{
daysleft = daysleft + dayarray[i];
}

// accounting for year differences
if (yr != todayy)
{
daysleft = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31)*( yr - todayy);
}

//consider minutes left in current day
minutesleft = (daysleft*24*60) + (hoursleft*60) + minleft;

secondsleft = (minutesleft*60) + todays;

// forecast is a parameter
revenue = (forecast - ((1463 / 60)*secondsleft)).toFixed(2);

document.getElementById('days').innerHTML=daysleft;
document.getElementById('minutes').innerHTML=minutesleft;
document.getElementById('revenue').innerHTML=revenue;
document.getElementById('seconds').innerHTML=todays;
tick=setTimeout("simpleClock()",1000);
}
</SCRIPT>
``````
0
techguy20170
1 Solution

Solution Analyst & ArchitectCommented:
1. use var revenue on line 57.
2. If days, minutes, revenue and seconds are textboxes, try using .value instead of innerHTML.
0

Author Commented:
it was the "VAR" Missing.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Featured Post

Tackle projects and never again get stuck behind a technical roadblock.