a how-to question
Posted: Fri Apr 22, 2005 12:44 pm
I have two javascript functions. I would like for the second one to be dependant on the completion of the first one.
Here is the code.
And for the body tag I have this.
How can I make it so that the function showForm ONLY happens when var secs (from funtion Go() ) reaches 0 ?
As it is functioning now, if there is a heavily designed/programmed page, showForm will display before var secs = 0
Here is the code.
Code: Select all
<script>
<!--
var timeout = 1000; var num = 0; var na = "e;00"e;; var secs = <? if($premiumarrayї'premium'] == "e;y"e;){ echo "e;10"e;;} ELSE { echo "e;20"e;; } ?>;
function go(which){
na = secs;
if (secs < 10) { na = "e;0"e; + na; }
document.getElementById("e;timerbox"e;).innerHTML = "e;<h3><font color=#FFFFFF>"e; +na+ "e;</font></h3>"e;;
secs = secs - 1
if (secs+1 > 0) { setTimeout("e;go()"e;,timeout); }
if (secs+1 < 1) { document.getElementById("e;timerbox"e;).style.display='none'; showForm(which); }
}
function showForm(which) {
showit = window.setTimeout(function() { which.style.display='block' }, '<? if($premiumarrayї'premium'] == "e;y"e;){ echo "e;10000"e;;} ELSE { echo "e;20000"e;; } ?>');
}
-->
</script>Code: Select all
<BODY onLoad="e;go(); showForm(document.getElementById('countDownText'));"e;>As it is functioning now, if there is a heavily designed/programmed page, showForm will display before var secs = 0