怎么打小广告html,作业之小广告.html

Document

* {

padding: 0;

margin: 0;

}

.wrap {

position: fixed;

padding: 5px;

width: 320px;

height: 400px;

right: 5px;

bottom: 5px;

background-color: gainsboro;

}

.wrap .ad {

display: flex;

justify-content: space-between;

}

#dateBox {

display: flex;

}

.content {

padding-top: 20px;

}

.content p {

margin-top: 20px;

}

#adBox{

display: none;

}

距离广告关闭还有 10
X

// 0. 页面打开5秒后小广告出来

// 1. 倒计时10秒后关闭,关闭后5s自动打开 (10秒倒计时)

// 2. 点击 X 直接关闭 ,关闭后5s自动打开 (10秒倒计时)

var datebox=document.getElementById("dateBox")

var weekBox=document.getElementById("weekBox")

var timeBox=document.getElementById("timeBox")

var week=["seven","one","two","three","four","five","six"]

var date=new Date();

var year=date.getFullYear();

var month=date.getMonth()+1;

var date_1=date.getDate();

var day=date.getDay();

var hours=date.getHours();

var minute=date.getMinutes();

var seconds=date.getSeconds();

var adBox=document.getElementById("adBox")

var count=document.getElementById("count");

zero(year);

zero(month);

zero(date);

zero(hours);

zero(minute);

zero(seconds);

function changeImg(num){

var num=num+""

var str=""

for(var i=0;i

var a=num.charAt(i)

str += ''

}

return str

console.log(str)

}

function zero(a){

a=a<10?"0"+a:a;

return a;

}

var gb=document.getElementById("close");

function fn(){

var date=new Date();

var year=date.getFullYear();

var month=date.getMonth()+1;

var date_1=date.getDate();

var day=date.getDay();

var hours=date.getHours();

var minute=date.getMinutes();

var seconds=date.getSeconds();

year=zero(year);

month=zero(month);

date=zero(date);

hours=zero(hours);

minute=zero(minute);

seconds=zero(seconds);

console.log(year,month,date_1,day,hours,minute,seconds)

datebox.innerHTML=changeImg(year)+"年"+changeImg(month)+"月"+changeImg(date_1)+"日"

weekBox.innerHTML=w(day)

timeBox.innerHTML=changeImg(hours)+" "+changeImg(minute)+" "+changeImg(seconds)

}

function w(num){

var str=""

str='星期'

return str

}

setInterval(fn,1000)

setTimeout(fn_djs,5000)

var time;

function fn_djs(){

adBox.style.display="block";

var i=10;

count.innerHTML=i;

time=setInterval(function(){

i--;

count.innerHTML=i

if(i<=0){

clearInterval(time)

adBox.style.display="none"

setTimeout(function(){

fn_djs()

},4000)

}

},1000)

}

gb.οnclick=function (){

clearInterval(time)

adBox.style.display="none"

setTimeout(function(){

fn_djs()

},4000)

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值