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

解决 firefox下     useless Interval call (missing quotes around argument?)  报错。

 

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

 

写了这样一个间隔刷新页面的函数,但是运行的时候在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;


你可能感兴趣的:(Math.random())