<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
var count=0;
var times;
var stops;
var flag=true;
window.οnlοad=function()
{
times= window.setInterval("start()",1000);
}
function stop()
{
var s = document.getElementById("img1");
if(flag==true)
{
window.clearInterval(times);
s.style.display = "none";
flag=false;
stops = window.setInterval("stop()",1000);
}
if(flag==false)
{
count++;
spantime();
if (count == 5)
{
count=0;
flag=true;
window.clearInterval(stops);
s.style.display = "block";
times = window.setInterval("start()", 1000);
}
}
}
function start()
{
count++;
if(count==5)
{
count=0;
stop();
}
else
{
spantime();
}
}
function spantime()
{
var dates =new Date();
var imgdate =document.getElementById("timeshowlocate");
var date =dates.getFullYear()+"年"+dates.getMonth()+"月"+dates.getDate()+
"日"+dates.getHours()+"时"+dates.getMinutes()+"分"+dates.getSeconds()+"秒";
imgdate.innerHTML=date;
}
</script>
</head>
<body>
<img src="xx.jpg" id="img1">
<span id="timeshowlocate"></span>
</body>
</html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
var count=0;
var times;
var stops;
var flag=true;
window.οnlοad=function()
{
times= window.setInterval("start()",1000);
}
function stop()
{
var s = document.getElementById("img1");
if(flag==true)
{
window.clearInterval(times);
s.style.display = "none";
flag=false;
stops = window.setInterval("stop()",1000);
}
if(flag==false)
{
count++;
spantime();
if (count == 5)
{
count=0;
flag=true;
window.clearInterval(stops);
s.style.display = "block";
times = window.setInterval("start()", 1000);
}
}
}
function start()
{
count++;
if(count==5)
{
count=0;
stop();
}
else
{
spantime();
}
}
function spantime()
{
var dates =new Date();
var imgdate =document.getElementById("timeshowlocate");
var date =dates.getFullYear()+"年"+dates.getMonth()+"月"+dates.getDate()+
"日"+dates.getHours()+"时"+dates.getMinutes()+"分"+dates.getSeconds()+"秒";
imgdate.innerHTML=date;
}
</script>
</head>
<body>
<img src="xx.jpg" id="img1">
<span id="timeshowlocate"></span>
</body>
</html>