取1-13随机数
<!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>
<div id="suiji"></div>
<input type="button" value="开始" onclick="showname()" />
</body>
<script type="text/javascript"> var arr=new Array("1","2","3","4","5","6","7","8","9","10","11","12","13");
var bs=0;
function showname()
{
var bian=Math.floor(Math.random() * 13);
var s = document.getElementById("suiji");
s.innerText = arr[bian];
bs=bs+1;
if(bs==30)
{
window.clearTimeout(jian);
}
else
{
var jian=window.setTimeout("showname()",30);
} }
</script>
</html>