易截截图软件、单文件、免安装、纯绿色、仅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(011)

Repaints and Reflows  重绘和重排版
    Once the browser has downloaded all the components of a page—HTML markup, JavaScript, CSS, images—it parses through the files and creates two internal data structures:
    当浏览器下载完所有页面HTML标记,JavaScri ......

[翻译]High Performance JavaScript(028)

JavaScript Minification  JavaScript紧凑
    JavaScript minification is the process by which a JavaScript file is stripped of everything that does not contribute to its execution. This includes comments and unnecessary whitespace. The process typically reduces the file size by ha ......

[翻译]High Performance JavaScript(029)

Working Around Caching Issues  关于缓存问题
    Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......

[翻译]High Performance JavaScript(030)

第十章  Tools  工具
    Having the right software is essential for identifying bottlenecks in both the loading and running of scripts. A number of browser vendors and large-scale websites have shared techniques and tools to help make the Web faster and more efficient. This ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号