Originariamente inviato da xalfryx
non va....

senti ma non è possibile associare lo start del countdown al onload di una immagine????
certo, si può fare

codice:
<script>
    var seconds = 3600;

    function $(id) {
      return document.getElementById(id);
    }


    function writecounter(hh, mm, ss) {
        $('ore').value = (hh < 10)? "0"+hh : hh;
        $('min').value = (mm < 10)? "0"+mm : mm;
        $('sec').value = (ss < 10)? "0"+ss : ss;
    }


    function startcount() {
    
        hh = Math.floor(seconds / 3600);
        mm = Math.floor((seconds - (hh*3600)) / 60);
        ss = seconds - (hh*3600) - (mm*60);
        writecounter(hh, mm, ss);
        seconds--;
        if (seconds != -1) {
        setTimeout('startcount()', 1000)
        }
        else {
        // fai qualcosa
        alert("ho finito!");
        }

    }


    var hh = Math.floor(seconds / 3600);
    var mm = Math.floor((seconds - (hh*3600)) / 60);
    var ss = seconds - (hh*3600) - (mm*60);
</script>

<body>

    <form>
    <input type="text" size="2" id="ore" readonly="readonly" /> :
    <input type="text" size="2" id="min" readonly="readonly" /> :
    <input type="text" size="2" id="sec" readonly="readonly" />
    </form>

    <script>
    writecounter(hh, mm, ss);
    </script>


    [img]delpierogoal.jpg[/img]
</body>