下边的HTML代码,可以取出日期与星期
<html>
<body>
<h1>
<script language=JavaScript>
var d, s = "";
var x = new Array("星期日", "星期一", "星期二","星期三","星期四", "星期五","星期六");
d = new Date();
s+=d.getFullYear()+"年"+(d.getMonth() + 1)+"月"+d.getDate()+"日 ";
s+=x[d.getDay()];
document.writeln(s);
</script>
</h1>
</body>
</html>
时间: 2024-10-13 17:25:43