O mica problema la un script

Donator
Înscris
6 Mar 2012
Mesaje
451
Salutare.

Acesta este un script de download, dar cu un delay de cateva secunde. Il puteti testa aici: http://htmledit.squarefree.com/

Problema mea este ca la sfarsitul celor 20 de secunde de asteptare, imi ramane cifra 1. Cum as putea sa fac sa se ascunda imediat dupa ce se termina ?

Cod:
<html><head>
<script type="text/javascript">
var c = 20;
function fcwait() {
if(document.getElementById("divDLWait")==null || document.getElementById("divDLStart")==null){
setTimeout("fcwait()", 1000);
return;
}
if (c > 0) {
var el = document.getElementById("downloadDelayTimeSec");
if( el ){
el.innerHTML = "" + c;
}
c = c - 1;
setTimeout("fcwait()", 1000);
}
else {
document.getElementById("divDLWait").style.display = 'none';
document.getElementById("divDLStart").style.display = 'block';

}
}
fcwait();



</script>
<style>

#divDLStart{
display: none;

}


</style>

</head>

<body>

<div id="divDLWait"> Please wiat until the download link appears</div>



<div id="divDLStart"> <a href="www.google.com">Download Link</a></div>




<div id="downloadDelayTimeSec">20</div>



<div id=""></div>
<div id=""></div>
<div id=""></div>


</body></html>

Astept un raspuns daca cineva ma poate ajuta.

Multumesc mult, o zi buna !
 
Veteran
Donator
Înscris
25 Sep 2013
Mesaje
1.653
Nu stiu cum sa dispara, dar daca vrei sa.ti apara 0 macar in loc de 1 pui la "if (c > 0)" -1 in loc de 0
 
Donator
Înscris
6 Mar 2012
Mesaje
451
E tot acelasi lucru.. faza e ca se vede aiurea, orice cifra ar ramane.
 
Membru
Înscris
30 Sep 2012
Mesaje
26
Foarte simplu, adauga div-ul <div id="downloadDelayTimeSec">20</div> in interiorul div-ului <div id="divDLWait"> Please wiat until the download link appears</div>

Adica asa : <div id="divDLWait"> Please wiat until the download link appears
<div id="downloadDelayTimeSec">20</div>
</div>
 
Membru
Înscris
22 Sep 2014
Mesaje
26
sub

document.getElementById("divDLStart").style.display = 'block';

adauga

document.getElementById("downloadDelayTimeSec").innerHTML = "";
 
Sus