<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js消灭QQ表情小游戏源码</title>
<script src="js/global.js"></script>
</head>
<style>
body, ul, dl, dd, dt, ol, li, p, h1, h2, h3, h4, h5, h6, textarea, form, select, fieldset, table, td, div, input {margin:0;padding:0;-webkit-text-size-adjust: none}
.head { text-align: center; padding: 20px 0 }
.head p { line-height: 40px; }
.head h2 { font-size: 20px; padding: 10px 0 }
.head input { padding: 1px 3px; }
.wrap { width: 700px; height: 400px; border-radius:0 0.3em 0.3em 0.3em; border: 2px solid #5F2401; margin: 0 auto; position: relative; top: 0; left: 0; }
.side { width: 120px; height: 90px; border: 2px solid #5F2401; position: absolute; top: -2px; border-radius:0.3em 0 0 0.3em; right: 100%; background: #FC0; }
.side p { padding: 0px 15px; line-height: 25px; font-size: 16px; }
.side p:nth-of-type(1) { margin-top: 15px; }
.main { width: 100%; height: 100%; position: absolute; top: 0; left: 0; overflow: hidden; background: #FFF; }
.main i { width: 24px; height: 24px; border-radius: 50%; display: block; position: absolute; top: 0; left: 0; cursor: pointer }
.main img { width: 24px; }
.side b{ color: #F00; }
</style>
<script>
window.onload = function(){
var oBox = $('#box'),
oBtn = getTagName(document,'input')[0],
oMin = getClass(oBox,'.main')[0];
var aB = getTagName(oBox,'b');
var W = parseInt(getCss(oMin,'width')),
H = parseInt(getCss(oMin,'height'));
oBtn.onclick = function(){
this.disabled = true;
this.value = '游戏正在进行中...'
console.dir(oBtn)
oMin.innerHTML = '<i></i>'
var oI = getTagName(oMin,'i')[0];
var b = 0,t = 0;
var k = 2
aB[0].innerHTML = b
aB[1].innerHTML = t
fn()
function fn(){
oI.style.top = '0';
oI.style.left = $fn.random([0,W-24]) + 'px';
oI.innerHTML = '<img src="QQexp/'+ $fn.random([1,51]) +'.gif"/>'
$fn.Move(oI,'top',k,H-24,function(){
++t
aB[1].innerHTML = t
$fn.shaKe(oBox,'top',10,function(){
if(!score()) fn()
})
})
}
function score(){
if(t == 5){
alert('GAME OVER')
oBtn.disabled = false;
oBtn.value = '开始游戏'
oI.style.top = '-23px';
return true
}
if(b == 100){
alert('你赢了')
oBtn.disabled = false;
oBtn.value = '开始游戏'
oI.style.top = '-23px';
return true
}
}
oI.onmousedown = function(){
clearInterval(oI.timer)
this.innerHTML = '<img src="QQexp/36.gif"/>'
oI.timer = null;
++b
k+=0.2
k.toFixed(1)
aB[0].innerHTML = b
$fn.shaKe(oI,'left',10,function(){
if(!score()) fn()
})
}
}
}
</script>
<body>
<div class="head">
<h2>你的鼠标有多快?</h2>
<p>游戏说明:点击“开始游戏”,随机掉下QQ表情,点中它,千万别让它掉下去!!</p>
<p>
<input type="button" value="开始游戏" />
</p>
</div>
<div id="box" class="wrap">
<div class="side">
<p>得分:<b>0</b> 分</p>
<p>失分:<b>0</b> 分</p>
</div>
<div class="main"></div>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.</p>
</div>
</body>
</html>
JS实现的消灭QQ表情小游戏源码.zip
版权申诉
188 浏览量
2022-11-01
01:01:27
上传
评论
收藏 155KB ZIP 举报
毕业_设计
- 粉丝: 1936
- 资源: 1万+
最新资源
- 基于ARM的指令调度和延迟分支
- 基于Vue和TypeScript的极简聊天应用设计源码 - HasChat
- 基于Vue2全家桶和Zcool数据的图片收集网站设计源码 - cool-picture
- 基于C和C++的二维绘制工具设计源码 - DrawPro
- Object.defineProperty 的 IE 补丁object-defineproperty-ie-master.zip
- 整卷预览.mhtml
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- 基于Javascript的结婚请帖设计源码 - Invitation
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈