windows8五子棋 游戏

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <title>五子棋</title>

    <!-- WinJS 引用 -->
    <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
    <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>

    <!-- 五子棋 引用 -->
    <link href="/css/default.css" rel="stylesheet" />
    <script src="/js/default.js"></script>
    <style>
*{
 margin:0;
 padding:0;
}
#main{
 width:502px;
 height:502px;
 border-top:#555 solid 1px;
 border-right:#555 solid 1px;
 background-color:#CCC;
 margin:0px auto;
 position:absolute;
 z-index:1;
}
#main .div{
 width:19px;
 height:19px;
 border-bottom:#555 solid 1px;
 border-left:#555 solid 1px;
 float:left;
 display:inline;
 line-height:19px;
}
#main2{
 position:absolute;
 z-index:2;
 padding:10px;
 width:480px;
 height:480px;
}
#main2 span{
 width:20px;
 height:20px;
 display:block;
 float:left;
 cursor:pointer;
       line-height:20px;
 font-size:1px;
}
#main2 span.wb{
 background:url(/jscss/demoimg/200901/jMpx.gif) no-repeat;
}
#main2 span.bb{
 background:url(/jscss/demoimg/200901/lq.gif) no-repeat;
}
#aa{
 text-align:center;
 height:36px;
 line-height:36px;
 font-size:17px;
}
</style>
<script type="text/javascript">
    function $(o) {
        return document.getElementById(o);
    }
    var flag = 0;
    var black = "黑方"
    var witer = "白方"
    function played() {
        var piece = $("main2").getElementsByTagName("span");
        for (var i = 0; i < piece.length; i++) {
            piece[i].onclick = function () {
                showPieces(this);
                return false
            }
        }
    }
    function showPieces(t) {
        if (t.className != "wb" && t.className != "bb") {
            if (flag == 0) {
                t.className = "wb"
                flag = 1;
                panduan(witer)
            } else {
                t.className = "bb"
                flag = 0;
                panduan(black)
            }
        }
    }
    function panduan(te) {
        $("aa").innerHTML = "当前执棋:" + te
    }
</script>
</head>
<body>
<div id="aa"></div>
<div id="main"></div>
<div id="main2"></div>
<script type="text/javascript">
    var _div = []
    var _span = []
    for (i = 0; i < 625; i++) {
        _div[i] = document.createElement("div");
        _div[i].className = "div"
        $("main").appendChild(_div[i])
    }
    for (j = 0; j < 576; j++) {
        _span[j] = document.createElement("span")
        $("main2").appendChild(_span[j])
    }
    panduan(black)
    played()
</script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值