抽奖
来源:互联网 发布:曹进德 知乎 编辑:程序博客网 时间:2024/06/10 15:49
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>抽奖</title> <meta http-equiv="Content-Type" content="text/html; charset=GB2312" /> <style type="text/css"> #lp{ width:600px; height:600px; background-image: url(plate_06.png); margin:0 auto; z-index: 9; } #button{ background-image: url(plate_04.png); background-position: 0 0px; z-index: 10; position:absolute; top:228px; left: 594px;; width:150px; height: 150px; cursor: pointer; } #gl{ height:592px; width:592px; background:url('plate_05.png') left top; background-repeat: no-repeat; background-position: 0 0px; margin:0 auto; position: absolute; top: 8px; left: 380px; border: solid 1px; } </style></head><body> <div id="lp"> </div> <div id="button"></div> <div id='gl'> <img src="plate_03.png" /> </div> <script type="text/javascript"> var count = 1 ; var sz ; var stop; var sum = 1; function countAward(){ var award = [ '5M 永久空间', '80M 永久空间', '1G 永久空间', '200M 永久空间', '100M 永久空间', '20M 永久空间', '继续攒人品', '10G 永久空间', '50M 永久空间', '1T 永久空间', ] return award[count-1]; } function getRandom(n){ return Math.floor(Math.random()*n+1) } function setHeight(){ var height = -592; var gl = document.getElementById('gl'); gl.style.backgroundPosition = '0'+''+height*count+'px'; count += 1; sum += 1; if(count === 11){ gl.style.backgroundPosition = '0 0'; count = 1; } if(sum === sz){ clearInterval(stop); alert('恭喜您获得'+countAward()); } } function moveA(){ sz = getRandom(20); alert(sz); stop = setInterval(setHeight,300); } function init(){ var btn = document.getElementById( 'button' ); btn.addEventListener('mouseover',function(){ btn.style.backgroundPosition = '0 150px'; },false); btn.addEventListener('mouseout',function(){ btn.style.backgroundPosition = '0 0px'; },false); btn.addEventListener('click',moveA,false); } window.onload = init; </script></body></html>
0 0
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- 抽奖
- dfs 实例
- MATLAB中使用结构体 -- 结构(struct)数组
- c++ 第四章 继承和派生
- 程序开发最常用的10大算法
- 图搜索之A*算法、深度优先搜索和广度优先搜索
- 抽奖
- delphi 各种数据类型转换总结
- 迷宫简单代码
- 右键自定义菜单
- 雄踞AppStore榜首的游戏<别踩到白块儿>源代码分析和下载(一)
- 2014腾讯实习招聘题目
- hibernate 注解
- SP2010开发和VS2010专家"食谱"--第一章节--列表和事件Receiver(8)--创建Feature Receiver
- C++实现小根堆