用HTML和jquery写一个简单的扫雷小游戏

这篇博客展示了如何利用HTML和jQuery编写一个简单的扫雷游戏。通过引用jQuery库,作者简化了代码实现,提供了游戏的代码示例,并且展示了一个实际的游戏效果。
摘要由CSDN通过智能技术生成

用HTML和jquery写一个简单的扫雷小游戏

代码如下

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扫雷3.0</title>
    <script src="jquery-1.11.0.js"></script>
    <style>
        .button{
    
            background-color: crimson;
            color: white;
            display: inline-block;
            font-size: 16px;
            width:150px;
            height:50px;
        }
        .square{
    
            width: 41px;
            height: 41px;
            font-size: 16px;
            color: black;
            margin-left: 3px;
            margin-top: 2px;
        }
        #mas{
    
            width: 300px;height:30px;
            position: absolute;
            left: 1030px;
            top: 570px;
            font-size: 17px;
            color: red;
        }
    </style>
</head>
<body bgcolor="#deb887">
<div style="float: top;
            border:2px solid grey ;
            width:100%;
            height:100px;
            margin: 0 auto;   ">


</div>

<div id ="panel" style="float: top;
            border:2px solid grey ;
            width:400px;
            height:400px;
            margin: 0 auto;   background-color: grey">


</div>
<div style="float: top;
            border:2px solid grey ;
            width:100%;
            height:100px;
            margin: 0 auto;   ">
    <input type="button"value="消除/插旗" style="position:relative;
     margin-left: 500px;top: 10px" class="button" οnclick="mchange()">

    <input type="button"value="重新开始" class="button" style="position:relative;
     margin-left: 50px;top: 10px" οnclick="location.reload()">
    <input type="text" id="mas" value="模式:消除">

</div>
</body>
<script>
    var model=1;
    var victory=0;//消除的方块数
    var sqnums=new Array();
    var sqable=new Array();//判断方块是否可操作
    $(function () {
    
        for(var i=0;i
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值