通過javascript實現(xiàn)掃雷游戲代碼實例
更新時間:2020年02月09日 10:58:23 作者:shumeihh
這篇文章主要介紹了通過javascript實現(xiàn)掃雷游戲代碼實例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
這篇文章主要介紹了通過javascript實現(xiàn)掃雷游戲代碼實例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
html代碼:
<div id="mine">
<div class="level">
<button type="button">初級</button>
<button type="button">中級</button>
<button type="button">高級</button>
<button type="button">重新開始</button>
</div>
<div class="gameBox"></div>
<div class="info">
剩余雷數(shù):<span class="mineNum"></span>
</div>
</div>
css代碼:
#mine {
margin: 50px auto;
}
.level {
text-align: center;
margin-bottom: 10px;
}
.level button {
padding: 5px 15px;
background-color: cornflowerblue;
border: none;
color: #fff;
border-radius: 3px;
outline: none;
cursor: pointer;
}
.level button.active {
background-color: #00abff;
}
.info {
margin-top: 10px;
text-align: center;
}
table {
border-spacing: 1px;
background: #929196;
margin: 0 auto;
}
td {
padding: 0;
width: 20px;
height: 20px;
background: #ccc;
border: 2px solid;
border-color: #fff #a1a1a1 #a1a1a1 #fff;
text-align: center;
line-height: 20px;
font-weight: bold;
}
td.zero {
border-color: #D9D9D9;
background: #D9D9D9;
}
td.one {
border-color: #D9D9D9;
background: #D9D9D9;
color: #0332fe;
}
td.two {
border-color: #D9D9D9;
background: #D9D9D9;
color: #019f02;
}
td.three {
border-color: #D9D9D9;
background: #D9D9D9;
color: #ff2600;
}
td.four {
border-color: #D9D9D9;
background: #D9D9D9;
color: #93208f;
}
td.five {
border-color: #D9D9D9;
background: #D9D9D9;
color: #019f02;
}
td.six {
border-color: #D9D9D9;
background: #D9D9D9;
color: #ff3fff;
}
td.seven {
border-color: #D9D9D9;
background: #D9D9D9;
color: #3fffbf;
}
td.eight {
border-color: #D9D9D9;
background: #D9D9D9;
color: #22ee0f;
}
.mine {
background: #d9d9d9 url(./mine.png) no-repeat center;
background-size: cover;
}
.flag {
background: #ccc url(./flag.png) no-repeat center;
background-size: cover;
}
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
前端處理ASCII碼轉(zhuǎn)HEX碼及校驗具體實現(xiàn)
這篇文章主要介紹了在JavaScript編程中將ASCII碼轉(zhuǎn)換為十六進(jìn)制(HEX)碼的需求和場景,包括Wi-Fi配置、數(shù)據(jù)加密和網(wǎng)絡(luò)協(xié)議傳輸?shù)?文章詳細(xì)描述了HEX編碼的原理和作用,并提供了具體實現(xiàn)的示例,需要的朋友可以參考下2025-03-03
JavaScript使用localStorage存儲數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了JavaScript使用localStorage存儲數(shù)據(jù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-09-09
詳解webpack+ES6+Sass搭建多頁面應(yīng)用
這篇文章主要介紹了webpack+ES6+Sass搭建多頁面應(yīng)用,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-11-11
layui監(jiān)聽復(fù)選框checkbox選中以及分頁選中處理方式
這篇文章主要介紹了layui監(jiān)聽復(fù)選框checkbox選中以及分頁選中處理方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2019-09-09

