为什么在span里设置文字颜色没有效果,<!DOCTYPE html><html><head> <meta charset="UTF-8" /> <title>显示当前时间.htm</title> <style> .timer{ width: 150px; height: 20px; line-height: 20px; background-color: black; text-align: center; margin: 30px auto; /*color: rgb(255,255,255);*/ } .clock{ color: rgb(255,255,255); } </style></head><body> <div class="timer"> <span id="clock">1</span> </div> <script> function distime(){ var elt = document.getElementById("clock") var now = new Date(); elt.innerHTML = now.toLocaleTimeString() setTimeout(distime,1000) } window.onload = distime; </script></body></html>效果图:
添加回答
举报
0/150
提交
取消