js5秒倒计时

    <script language="javascript" type="text/javascript">
        var i = 5;
       intervalid= setInterval("fun()", 1000);
        function fun() {
            if (i == 0) {
                window.location.href = "default.aspx";
                clearInterval(intervalid);
        }
            document.getElementById("mes").innerHTML = i;
            i--;
        }
    </script>

你可能感兴趣的:(JavaScript)