• April 10, 2018
    <?php
    header('Location: login.php'); // redirects the user instantaneously.
    exit;
    ?>
    <?php
    header('refresh: 10; url=login.php'); // redirect the user after 10 seconds
    #exit; // note that exit is not required, HTML can be displayed.
    ?>
    <p>You will be redirected in <span id="counter">10</span> second(s).</p>
    <script type="text/javascript">
    function countdown() {
        var i = document.getElementById('counter');
        if (parseInt(i.innerHTML)<=0) {
            location.href = 'login.php';
        }
        i.innerHTML = parseInt(i.innerHTML)-1;
    }
    setInterval(function(){ countdown(); },1000);
    </script>

    หรือ ใช้  javascript

    var counter = 10;
    setInterval(function() {
        counter--;
        if(counter < 0) {
            window.location = 'login.php';
        } else {
            document.getElementById("count").innerHTML = counter;
             }
    }, 1000);​

    หรือ

    <b><span id="count">10</span> Seconds</b>
    var count = 10;
    function decrement() {
        count--;
        if(count == 0) {
            window.location = 'login.php';
        }
        else {
            document.findElementById("count").innerHTML = "" + count;
            setTimeout("decrement", 1000);
        }
    }
    setTimeout("decrement", 1000);

    https://stackoverflow.com/questions/12498209/redirect-10-second-countdown



เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories