javascriptカウントダウンタイマ


<script type="text/javascript">
    var times = 45 * 60;//    ,   
    var timeDiv = document.getElementById("time");
    var timeObj = null;
    function timer(){
        if(times == 0){
            //     ,    
            document.getElementById("frm").submit();
            window.clearInterval(timeObj);
            return;
        }
        var t = Math.floor(times/60) +" "+times%60+" "
        timeDiv.innerHTML = t;
        times --;
    }
    timeObj = window.setInterval(timer,1000);
</script>