在JavaScript中在图像上方显示图像几秒钟?

时间:2017-08-01 20:48:53

标签: javascript html

我有一个数据小部件,每次单击小部件时页面都会刷新。当我离线时,我想在数据图像上方显示一个nowifi图像3秒钟。

我在数据图片中有SQ. FT. AREA 1 2 400 86.6600 86.7300 500 82.3300 82.4000 600 78.9600 79.0200 700 76.2100 76.2700 800 73.9100 73.9700 900 71.9400 71.9900 1000 70.2200 70.2700 1100 68.7000 68.7500 1200 67.3400 67.3900 1300 66.1200 66.1600 1400 65.0000 65.0400 1600 63.0400 63.0800 1800 61.3600 61.3900 2000 59.8900 59.9300 2200 58.6000 58.6300 2400 57.4400 57.4700 2600 56.3900 56.4200 2800 55.4400 55.4700 3000 54.5700 54.6000 3100 54.1334 54.1632 3200 53.8060 53.8356 3300 53.3695 53.3988 3400 52.9875 53.0166 3500 52.6055 52.6344 3600 52.2781 52.3068 3700 51.9506 51.9792 3800 51.6232 51.6516 4000 50.9684 50.9964 个功能。

如何在数据图像上方显示nowifi图像几秒钟。

1 个答案:

答案 0 :(得分:0)

在你的HTML中把它放在某个地方

在你的javascript中:

var secondstildone = 3; var intervalVariable;

function wifioff(){

      $("#errorImg).attr("src", "Images/errorImg.png");

      var f = DoTimerStuff;
      intervalVariable = setInterval(f, 1000);
    }

        DoTimerStuff() { 
            secondstildone--;
            if(secondstildone <= 0){
               $("#errorImg).attr("src", "");
               clearInterval(intervalVariable);
             }

        }