<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
/*<!--默認(rèn)彈層不顯示-->*/
.hide{
display: none;
}
.s1{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: black;
opacity: 0.6;
z-index: 1;
}
.s2{
z-index: 2;
position: fixed;
width: 200px;
height: 200px;
left: 50%;
top: 50%;
margin-left: -100px;
margin-top: -100px;
background-color: white;
}
</style>
</head>
<body>
<div>
<input type="button" value="添加" onclick="showModel();">
<input type="button" value="全選" onclick="chooseall();">
<input type="button" value="取消" onclick="cancelall();">
<input type="button" value="反選" onclick="reversall();"><br>
<table>
<thead>
<tr>選擇 </tr>
<tr>主機(jī)名 </tr>
<tr>端口</tr>
</thead>
<tbody id="td">
<tr>
<td><input type="checkbox"></td>
<td>1.1.1.1</td>
<td>9999</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>1.1.1.2</td>
<td>9989</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>1.1.1.3</td>
<td>9997</td>
</tr>
</tbody>
</table>
</div>
<!--第一個遮罩層-->
<div class="s1 hide" id="r1"></div>
<!--第二個輸入框彈層-->
<div class="s2 hide" id="r2">
<input type="text"><br>
<input type="text"><br>
<input type="button" value="取消" onclick="hideModel();">
<input type="button" value="添加" >
</div>
<script>
function showModel() {
document.getElementById('r1').classList.remove('hide')
document.getElementById('r2').classList.remove('hide')
}
function hideModel() {
document.getElementById('r1').classList.add('hide')
document.getElementById('r2').classList.add('hide')
}
function chooseall() {
var tbody = document.getElementById('td');
var tr_list = tbody.children;
for (var i = 0;i<tr_list.length;i++){
var current_tr = tr_list[i];
var checkbox = current_tr.children[0].children[0];
checkbox.checked = true;
}
}
function cancelall() {
var tbody = document.getElementById('td');
var tr_list = tbody.children;
for (var i = 0;i<tr_list.length;i++){
var current_tr = tr_list[i];
var checkbox = current_tr.children[0].children[0];
checkbox.checked = false;
}
}
function reversall() {
var tbody = document.getElementById('td');
var tr_list = tbody.children;
for (var i = 0;i<tr_list.length;i++){
var current_tr = tr_list[i];
var checkbox = current_tr.children[0].children[0];
if (checkbox.checked == true){
checkbox.checked = false;
}else {
checkbox.checked = true;
}
}
}
</script>
</body>
</html>
html簡單table、彈層實(shí)例
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 1.核心的價值觀,伴我們一生,是行為背后最關(guān)鍵最穩(wěn)定的價值標(biāo)準(zhǔn),違背價值觀做的決策,會讓內(nèi)心波動,價值觀沒有好壞,...
- 承接上回 這回我們一起來看看春天里的字。(笑) 什么叫做春天里的字呢? 那大概是一種有清風(fēng),有陽光,有花香還有小姐...
- 引用約翰派博牧師的話:“在現(xiàn)實(shí)中,我們的痛苦和損失常常是一個試驗,檢驗我們是否珍視那位全智全能的上帝多于我們所失去...
- 按照官方文檔配置和安裝好passport,文檔在這里 https://laravel.com/docs/5.6/p...