<!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=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>
----------------------------------
我想点一下就随机转到某个地方而不是刷新页面一下 随机一下,,,求高手解答
先谢了各位!~
<html xmlns="http://www.w3.org/1999/xhtml">
<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>
----------------------------------
我想点一下就随机转到某个地方而不是刷新页面一下 随机一下,,,求高手解答
先谢了各位!~