解決 FF下 useless Interval call (missing quotes ar...

解決 firefox下     useless Interval call (missing quotes around argument?)  報錯。less

 

echo <<<JS
        <script>
                function restar()
                {
                    location.href='http://a.120ask.com/zhengtest?time='+Math.random();
                }
                window.setInterval(restar(),100);
                </script>
JS;dom

 

寫了這樣一個間隔刷新頁面的函數,可是運行的時候在FF下老是報錯   useless Interval call (missing quotes around argument?)   雖不影響函數執行,可是看着忒彆扭。查了些資料發現這樣寫就可解決此錯誤。函數

 

echo <<<JS
        <script>
                function restar()
                {
                    location.href='http://a.120ask.com/zhengtest?time='+Math.random();
                }
                window.setInterval(function(){restar()},100);
                </script>
JS;spa

相關文章
相關標籤/搜索