如何在网页上显示时间??
答案:1 悬赏:0 手机版
解决时间 2021-05-16 10:36
- 提问者网友:辞取
- 2021-05-16 00:59
如何在网页上显示时间??
最佳答案
- 五星知识达人网友:污到你湿
- 2021-05-16 01:28
把下面代码放在BODY ,这是动态的时候,每秒变化的....
<SCRIPT language=JavaScript>
<!--
function showtime()
{
today=new Date();
todays=today.toString();
todays=todays.split(" ");
if (window.navigator.userAgent.indexOf("MSIE")>=1){
document.getElementById("times").innerHTML = todays[2]+" "+todays[1]+" "+todays[5]+" ("+todays[0]+") "+todays[3]+" "+todays[4].replace("UTC","GMT");
}
else {
document.getElementById("times").innerHTML = todays[2]+" "+todays[1]+" "+todays[3]+" ("+todays[0]+") "+todays[4]+" "+todays[5];
}
setTimeout("showtime()",1000);
}
showtime();
-->
</SCRIPT>
<div id="time"><span id="times">Time & Date</span></div>
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯