易截截图软件、单文件、免安装、纯绿色、仅160KB

用JavaScript写的小时候玩的乒乓球小游戏

由于火狐浏览器不支持“removeNode”函数,所以一下代码只支持IE.
<!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>
<title>--乒乓球--</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
.main{
    width:690px;
    margin:0 auto;
}
#box{
    width:680px;
    height:340px;
    border:1px solid green;
    position:relative;
}
.pingpang{
    position:absolute;
    width:10px;
    height:10px;
    background-color:red;
    overflow:hidden;
}
.pingpangpai{
    position:absolute;
    width:60px;
    height:10px;
    background-color:black;
    overflow:hidden;
}
#bigin{
    margin:0 auto;
    margin:10px;
    padding:5px;
}
</style>
<script text="text/javascript" language="javascript">
var Px=0,Py=0;//乒乓首部
var PPx,PPy;//乒乓拍
var Gox=10,Goy=10;
var end=false;//过界
var isOver = false;//游戏结束
var score = 0;//分数
var isMove = 0;//乒乓拍可否移动
function $(id){
    return document.getElementById(id);
}
window.onload = function(){
    Px = Math.round(Math.random()*33)*20;
    createPingPang(Px,Py);
    createPingPangPai(300,330);
    AllDiv = $("box").all.tags("DIV");
    AllSpan = $("box").all.tags("SPAN");
        $("bigin").attachEvent('onclick',function(){
     &n


相关文档:

[翻译]High Performance JavaScript(014)

Recursion Patterns  递归模式
    When you run into a call stack size limit, your first step should be to identify any instances of recursion in the code. To that end, there are two recursive patterns to be aware of. The first is the straightforward recursive pattern represented ......

[翻译]High Performance JavaScript(026)

Use the Fast Parts  使用速度快的部分
    Even though JavaScript is often blamed for being slow, there are parts of the language that are incredibly fast. This should come as no surprise, since JavaScript engines are built in lower-level languages and are therefore compiled. Thou ......

[翻译]High Performance JavaScript(031)

Firebug
    Firefox is a popular browser with developers, partially due to the Firebug addon (available at http://www.getfirebug.com/), which was developed initially by Joe Hewitt and is now maintained by the Mozilla Foundation. This tool has increased the productivity of web develop ......

[翻译]High Performance JavaScript(032)

Fiddler
    Fiddler is an HTTP debugging proxy that examines the assets coming over the wire and helps identify any loading bottlenecks. Created by Eric Lawrence, this is a general purpose network analysis tool for Windows that provides detailed reports on any browser or web request. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号