解决 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

相关文章
相关标签/搜索