Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript设置更改背景?_Javascript_Flash_Setinterval - Fatal编程技术网

Javascript设置更改背景?

Javascript设置更改背景?,javascript,flash,setinterval,Javascript,Flash,Setinterval,我想使用javascript使一个元素在从页面更高的链接跳转到另一个链接时将其背景色更改为红色。然后在一秒钟后,它应该变回白色,以提供一种闪烁的效果。 我已经设法让它变为红色,然后再变回白色,只是它继续前进!谁能告诉我如何让它只闪烁一次吗 这是我的javascript代码 function glow() { setInterval( function() { var see = document.getElementById("see"); v

我想使用javascript使一个元素在从页面更高的链接跳转到另一个链接时将其背景色更改为红色。然后在一秒钟后,它应该变回白色,以提供一种闪烁的效果。 我已经设法让它变为红色,然后再变回白色,只是它继续前进!谁能告诉我如何让它只闪烁一次吗

这是我的javascript代码

 function glow() {
        setInterval( function() {

        var see = document.getElementById("see");
        var run = document.getElementById("run");
        var enter = document.getElementById("enter");

            see.style.backgroundColor = 'red'; 
            run.style.backgroundColor = 'red';
            enter.style.backgroundColor = 'red';
            }, 400);

        setInterval( function() {
        var see = document.getElementById("see");
        var run = document.getElementById("run");
        var enter = document.getElementById("enter");

                see.style.backgroundColor = 'white'; 
                run.style.backgroundColor = 'white';
                enter.style.backgroundColor = 'white'; 
                } , 1000);
    }

将setInterval更改为setTimeout,以便只执行一次。

谢谢!很好!