grafixgirl
12-09-2008, 05:00 PM
i dont know javascript at all..im just a copy and paster :)
i used this script for a countdown timer and workds great with IE but not with firefox..i want to know how to add an if, else statement so that it will just show 5:00 in the scripts place...or if u can just tell me how to make it cross browser compatible then that would be even better :)
the site is www.acaiburnfree.com
and here is the code
<SCRIPT language=JavaScript>
//New phone function end
var sec = 00; // set the seconds
var min = 5; // set the minutes
function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1;
} else {
min = min;
}
if (sec<=9) { sec = "0" + sec; }
time = (min<=9 ? "0" + min : min) + ":" + sec + "";
if (document.getElementById) { theTime.innerHTML = time; }
SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
countDown();
});
</SCRIPT>
then where i have the timer showing up
<SPAN id=theTime>
thanks so much!!
i used this script for a countdown timer and workds great with IE but not with firefox..i want to know how to add an if, else statement so that it will just show 5:00 in the scripts place...or if u can just tell me how to make it cross browser compatible then that would be even better :)
the site is www.acaiburnfree.com
and here is the code
<SCRIPT language=JavaScript>
//New phone function end
var sec = 00; // set the seconds
var min = 5; // set the minutes
function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1;
} else {
min = min;
}
if (sec<=9) { sec = "0" + sec; }
time = (min<=9 ? "0" + min : min) + ":" + sec + "";
if (document.getElementById) { theTime.innerHTML = time; }
SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
countDown();
});
</SCRIPT>
then where i have the timer showing up
<SPAN id=theTime>
thanks so much!!