hahahahazou hahahahazou
关注数: 17 粉丝数: 76 发帖数: 1,384 关注贴吧数: 59
【求找茬】 html5+js大转盘 为什么刷新一次随机一次 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-transitional.dtd&urlrefer=e9b2a1e0c6d358d677c4ee0138b67400"> <html xmlns="http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&urlrefer=d0f4243b5ce5e5fa54fdafc10831c319"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> #clock { position: relative; width: 600px; height: 600px; margin: 20px auto 0 auto; background: url(); list-style: none; } #sec, #min, #hour { position: absolute; width: 30px; height: 600px; top: 0px; left: 285px; } #sec { background: url(); z-index: 3; transform-origin:center center ; } </style> <script> window.onload = function() { var osec = document.getElementById('sec'); var obtn = document.getElementById('btn'); var speed = 0; var Arr = [90,180,270,360]; var n = Math.floor(Math.random() * Arr.length + 1)-1; obtn.onclick = function() { speed = 0; pao = setInterval(toRun,10); } function toRun() { osec.style.transform = "rotate(" + speed + "deg)"; speed+=10; if(speed>(720+Arr[n])) { clearInterval(pao); } } } </script> </head> <body> <input id="btn" name="" value="重新转动" type="button" /> <ul id="clock"> <li id="sec"></li> </ul> </body> </html> ---------------------------------- 我想点一下就随机转到某个地方而不是刷新页面一下 随机一下,,,求高手解答 先谢了各位!~
1 下一页