当前位置:网站首页>用j s编写红绿灯
用j s编写红绿灯
2022-07-21 05:23:00 【来康二锅头】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
ul{
width: 400px;
height: 300px;
margin: 60px auto;
}
li{
display: block;
border-radius: 50%;
width: 100px;
height: 100px;
margin-left: 10px;
float: left;
background-color:black;
text-align: center;
line-height: 80px;
font-size: 40px;
}
#time{
width: 80px;
height: 80px;
margin-left: 20px;
background-color:white;
float: left;
font-size: 60px;
color: rgb(248, 15, 15);
text-align: center;
line-height: 80px;
}
</style>
</head>
<body>
<div class="main">
<ul><li id="red">红</li>
<li id="yellow">黄</li>
<li id="green">绿</li>
<div id="time"></div>
</ul>
</div>
</div>
</body>
<script>
var now=5;
var flag=1;
function fun(){
/* document.getElementById("red").innerHTML=now--; */
/* console.log(now); */
if(flag==1){
if(now>=0)
document.getElementById("red").style.backgroundColor="red";
else{
now=3;
flag=2;
document.getElementById("red").style.backgroundColor="black"
}
document.getElementById("red").innerHTML=now--;
}
if(flag==2){
if(now>=0)
document.getElementById("yellow").style.backgroundColor="yellow";
else{
now=3;
flag=3;
document.getElementById("yellow").style.backgroundColor="black"
}
document.getElementById("yellow").innerHTML=now--;
}
if(flag==3){
if(now>=0)
document.getElementById("green").style.backgroundColor="green";
else{
now=3;
flag=1;
document.getElementById("green").style.backgroundColor="black"
/* document.getElementById("red").style.backgroundColor="red"; */
}
document.getElementById("green").innerHTML=now--;
}
}
fun();
setInterval(fun,1000);
</script>
</html>
边栏推荐
猜你喜欢
Applet to upload pictures
After VMware turns on NAT mode / host only mode, the host cannot Ping the virtual machine
kubectl get node运行时出现:Unable to connect to the server: x509: certificate signed by unknown authority
DOCTYPE and entity in xxE vulnerability are confused - Introduction to Web Security Foundation - XML external entity injection (xxE)
class file has wrong version 55.0, should be 52.0
【自然语言处理与文本分析】文本特征提取方法总结。关键词提取方法。公认效果较好的IDF,RCF。
[natural language processing and text analysis] summary of text feature extraction methods. Keyword extraction method. IDF and RCF with good effect are recognized.
MATLAB读取csv文件里面既有文本又有数字的文件怎么读取。(可以不止csv文件,txt等文件都可以)
Typora的下载及MarkDown使用
Mount local Yum source
随机推荐
【基础数据挖掘技术】KNN简单聚类
windows谷歌浏览器清除缓存的方法
Comment les applets utilisent la barre de navigation personnalisée
How to join enterprise wechat group chat with applets
结构化分析SD SASP
企业经营管理不二“法宝”:技术能力矩阵支撑下的数据中台
Applet to upload pictures
【特征选择】特征选择的几种方法
【特征学习】以深度学习和词嵌入为基础的特征学习
原生小程序使用 vant-weapp 引入
kubectl get node运行时出现:Unable to connect to the server: x509: certificate signed by unknown authority
Remove # from the path of uniapp access, and 404 appears
Replay attack as defense
Several methods of quickly checking the local public IP
小程序如何实现 商品的sku 筛选
[naturallanguageprocessing and text analysis] Why does our wordbag model not use the one hot encoding model when converting text unstructured data to structured data? How to improve it.
挂载本地YUM源
策略中心——企业建设数智运营平台的大脑
OSPF and rip
Three layer switch principle