随机点名程序与万年历
Posted 参谋长
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了随机点名程序与万年历相关的知识,希望对你有一定的参考价值。
随机点名程序
document.write(Math.random());
var stu = ["张三", "王五", "张二", "张一", "石大", "郭三", "冯二", "平五"];
var ran = Math.random();
var ran = ran * stu.length;
var ran = Math.floor(ran);
document.write(stu[ran]);
万年历
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="a"></div>
</body>
</html>
<script>
function jgxs(){
var time = new Date();
var year = time.getFullYear();
var month = time.getMonth()+1;
var day = time.getDate();
var hour = time.getHours();
var min = time.getMinutes();
var sec = time.getSeconds();
var time2 = year+"年"+month+"月"+day+"日"+" "+hour+":"+min+":"+sec;
document.getElementById("a").innerHTML=time2;
}
window.setInterval("jgxs()",500)
</script>
以上是关于随机点名程序与万年历的主要内容,如果未能解决你的问题,请参考以下文章