<scripttype="text/javascript">
setInterval(function() {
var week
var date
var today = new Date()
var year = today.getFullYear()
var month = today.getMonth() + 1
var day = today.getDate()
var ss = today.getDay()
var hours = today.getHours()
var minutes = today.getMinutes()
var seconds = today.getSeconds()
date = year + "年" + month +"月" + day + "日 "
if (ss == 0) week = "星期日"
if (ss == 1) week = "星期一"
if (ss == 2) week = "星期二"
if (ss == 3) week = "星期三"
if (ss == 4) week = "星期四"
if (ss == 5) week = "星期五"
if (ss == 6) week = "星期六"
if (minutes <= 9) minutes ="0" + minutes
if (seconds <= 9) seconds ="0" + seconds
document.getElementById('p_time').innerHTML = "今天是:" + date
+ week + " " + hours + ":" + minutes + ":" +
seconds
},
1000)
</script>
这里一定要注意,html里要有一个id为p_time的div。
1.第一种方法是行内样式,就是直接把CSS代码添加到html的标签中,作为标签的一种属性存在。
2.
第二种方式是内嵌样式,就是将CSS代码添加到<head></head>之间,并用<style></sty...
3.
第三种方法是链接样式,就是将“页面内容”和“样式代码”分类成两个文件或多个文件,实现html代码和css代码的完全分离。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)