13.26 中文日期样式(二).htm

来自「一些javascript的小例子希望对初学者有更好的帮助」· HTM 代码 · 共 20 行

HTM
20
字号
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script  LANGUAGE="JavaScript"> 
    document.write("<center><font size=+1><b>") //设置在文档中的显示样式
    today = new Date()                          //定义新的日期对象
    document.write("<center><small>")           //根据getDay方法,判断是星期几
    if (today.getDay() == 5) document.write("星期五")
    if (today.getDay() == 6) document.write("星期六")
    if (today.getDay() == 0) document.write("星期日")
    if (today.getDay() == 1) document.write("星期一")
    if (today.getDay() == 2) document.write("星期二")
    if (today.getDay() == 3) document.write("星期三")
    if (today.getDay() == 4) document.write("星期四") 
    document.write("</small></center>")
</script> 
</head>
<body>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?