Skus napriklad toto:
Kód:
<script>
window.onload = function()
{
var c = document.getElementById('countdown'),
b = document.getElementById('button'),
countdown = setInterval(function()
{
if (--c.firstChild.nodeValue <= 0)
{
clearInterval(countdown);
b.disabled = false;
c.parentNode.parentNode.removeChild(c.parentNode);
}
}, 1000);
}
</script>
<p>Ostava <span id=countdown>25</span> sekund</p>
<button id=button disabled>Klikni sem</button>
V elemente si ID countdown mas pocet sekund, ktore zostavaju. Po uplynuti tohto casu sa sfunkcni tlacitko s ID button a sucasne sa odstrani nadradeny element toho elementu #countdown, t.j. cely <P> - ak by si toto nechcel, zmaz ten riadok zacinajuci c.parentNode...