2个回答
展开全部
<html>
<body>
离半夜12点还有<span id="hour"></span>小时<span id="min">慧饥信</span>分
</body>
<script>
function countdown() {
var today = 肢枝new Date();
var h = today.getHours();
var m = today.getMinutes();
h = 23 - h;
m = 59 - m;
m = checkTime(m)
document.getElementById("hour").innerHTML=h;
document.getElementById("前轮min").innerHTML=m;
}
function checkTime(i) {
if (i<10) i = "0" + i;
return i;
}
setInterval("countdown()", 50);
</script>
<html>
追问
我是不是应该加一句来解决字符集的问题,这句有没有错?
追答
没错,还要注意html文件要以对应的编码(utf-8)保存
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
<div> 离半夜12点还改迹蠢有<span id="hour"></span> 小时 <span id="min"></span> 分 <span id="sec"></span> 秒</div>
<州世script type="text/javascript"核陪>
function showtime(){
var tartime = new Date();
var nowtime = new Date();
tartime.setHours(24,0,0,0);
var tartime = tartime.getTime();
var nowtime = nowtime.getTime();
var time = tartime - nowtime;
var seconds = Math.floor(time/1000);
var mins = Math.floor(seconds/60);
var hours = Math.floor(mins/60);
var nowmins = mins%60;
var nowsec = seconds%60;
document.getElementById('hour').innerHTML = hours;
document.getElementById('min').innerHTML = nowmins;
document.getElementById('sec').innerHTML = nowsec;
}
showtime();
setInterval(showtime,1000);
</script>
还加了秒数。倒计时。放在body中
<州世script type="text/javascript"核陪>
function showtime(){
var tartime = new Date();
var nowtime = new Date();
tartime.setHours(24,0,0,0);
var tartime = tartime.getTime();
var nowtime = nowtime.getTime();
var time = tartime - nowtime;
var seconds = Math.floor(time/1000);
var mins = Math.floor(seconds/60);
var hours = Math.floor(mins/60);
var nowmins = mins%60;
var nowsec = seconds%60;
document.getElementById('hour').innerHTML = hours;
document.getElementById('min').innerHTML = nowmins;
document.getElementById('sec').innerHTML = nowsec;
}
showtime();
setInterval(showtime,1000);
</script>
还加了秒数。倒计时。放在body中
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询