<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<SCRIPT language=JavaScript>
var alldata = "张一,张二,张三,张四,张五,张六,张七,张八,张九,张十" //抽奖的姓名,以,为分隔
var alldataarr = alldata.split(",")
var num = alldataarr.length-1
var timer
function change(){
document.getElementById("oknum").value = alldataarr[GetRnd(0,num)];
}
function start(){
clearInterval(timer);
timer = setInterval('change()',50); //50(毫秒)为变换间隔,越小变换的越快
}
function ok(){
clearInterval(timer);
}
function GetRnd(min,max){
return parseInt(Math.random()*(max-min+1));
}
</SCRIPT>
模拟抽奖:<INPUT id=oknum name=oknum><BUTTON accessKey=s
onclick=start()>开始(<U>S</U>)</BUTTON><BUTTON accessKey=o
onclick=ok()>停止(<U>O</U>)</BUTTON>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script type=text/javascript>
var now = new Date();
function CurentTime(){
var mm = now.getMinutes();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
var clock = now.getHours() +':';
if (mm < 10) clock += '0';
clock += mm+':';
if (ss < 10) clock += '0';
return(clock + ss);
}
function showTime(){
document.getElementById("clock").innerHTML = now.getYear()+"."+(now.getMonth()+1)+"."+now.getDate()+" "+ CurentTime();now.setSeconds(now.getSeconds()+1);}
window.onload=start;
function start(){
setInterval(showTime,1000);
}
</script>
现在时间:<body><span id="clock"></span>
</body>
</html>