JavaScript做的一个随机点名程序

来源:互联网 发布:键盘按键记录软件 编辑:程序博客网 时间:2024/04/30 01:55
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>点名</title><script language="javascript" type="text/javascript">var status = 1;var name = new Array('范  鹏','张子涵','代天明','孙  季','孙  磊','王鸿罡','曾凡丁','李  欢','朱  颖','王  莎','郑琳琳','朱振家','金  一','李成龙','苟  超','吴  桐','梁  良','刘  俊');function getname(){return name[Math.floor(Math.random()*name.length)];}function showname(){document.getElementById("name").innerHTML = getname();setTimeout("showname",200);}function goname(){intimer = setInterval(showname, 200);}function stopname(){if(status == 1){clearInterval(intimer);status = 0;}else{intimer = setInterval(showname, 200);status = 1;}}</script><style>#name{border:1px solid #000;margin:auto;font-size:36px;color:#000000;width:108px;height:1em;cursor:pointer;text-align:center;}</style></head><body onLoad="goname()"><div id="name" onClick="stopname()"></div></body></html>

0 0
原创粉丝点击