<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.xiugai {
position: fixed;
top: 50%;
left: 50%;
border: 1px solid #aaaaaa;
width: 600px;
height: 300px;
margin-top: -150px;
margin-left: -300px;
padding: 10px;
z-index: 3;
}
.c2 {
position: fixed;
background: #777;
right: 0px;
left: 0px;
top: 0px;
bottom: 0px;
/* height:100%;
width:100%; */
z-index: 2;
}
.hide {
display: none;
}
</style>
</head>
<body>
<p>
<input type="button" value="添加">
<input type="button" value="全選">
<input type="button" value="取消">
<input type="button" value="反選">
</p>
<table border="1">
<thead>
<tr>
<td>選擇</td>
<td>主機(jī)名</td>
<td>端口</td>
</tr>
</thead>
<tbody id="tb">
<tr>
<td>
<input type="checkbox">
</td>
<td>1.1.1.2</td>
<td>120</td>
<td>
<input type="button" value="修改">
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>1.1.1.3</td>
<td>130</td>
<td>
<input type="button" value="修改">
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>1.1.1.4</td>
<td>140</td>
<td>
<input type="button" value="修改">
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>1.1.1.5</td>
<td>150</td>
<td>
<input type="button" value="修改">
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>1.1.1.6</td>
<td>160</td>
<td>
<input type="button" value="修改">
</td>
</tr>
</tbody>
</table>
<div class ="xiugai hide">
<div>
<input type = "text">
</div>
<div>
<input type = "text">
</div>
<div>
<input type = "button" value="取消">
</div>
<div>
<input type = "button" value="確定">
</div>
</div>
<div class="c2 hide"></div>
<script src="jquery-1.12.4.js"></script>
<script>
$("p input[value = '全選']").click(function () {
$("table :checkbox").prop("checked", true);
})
$("p input[value = '取消']").click(function () {
// $("table :checkbox").prop("checked", false);
$("table :checkbox").each(function () {
this.checked = false;
})
})
$("input[value = '反選']").click(function () {
$("table :checkbox").each(function () {
if (this.checked == true) {
this.checked = false
}
else
this.checked = true;
})
})
$("input[value = '添加']").click(function () {
})
$("input[value = '修改']").click(function () {
$(".xiugai").removeClass("hide");
$(".c2").removeClass("hide");
var IPaddress = $(this).parent().siblings().eq(1).text();
var port = $(this).parent().siblings().eq(2).text();
$($(".xiugai input[type = 'text']")[0]).val(IPaddress);
$($(".xiugai input[type = 'text']")[1]).val(port);
// $(".xiugai input[type = 'text']").val(prot);
// console.log($(".xiugai input[type = 'text']")[0]);
// console.log($(".xiugai input[type = 'text']")[1]);//加數(shù)組后位dom對(duì)象 需要轉(zhuǎn)化為jQuery對(duì)象
// console.log($(".xiugai input[type = 'text']"));
})
$(".xiugai input[value = '取消']").click(function () {
$(".xiugai").addClass("hide");
$(".c2").addClass("hide");
$(".xiugai input[type = 'text']").val("");
})
$(".xiugai input[value = '確定']").click(function () {
$(".xiugai").addClass("hide");
$(".c2").addClass("hide");
var currentIp = $($(".xiugai input[type = 'text']")[0]).text();
var currentPort = $($(".xiugai input[type = 'text']")[1]).text();
})
</script>
</body>
</html>
jQuery簡(jiǎn)易模態(tài)對(duì)話(huà)框
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 一、模態(tài)對(duì)話(huà)框:壟斷了用戶(hù)輸入,當(dāng)一個(gè)模態(tài)對(duì)話(huà)框打開(kāi)時(shí),用戶(hù)只能與該對(duì)話(huà)框交互,而其他用戶(hù)界面對(duì)象收不到輸入信息。...
- 基于MFC,用模態(tài)對(duì)話(huà)框創(chuàng)建一個(gè)登陸對(duì)話(huà)框 靜態(tài)顯示圖片或?qū)υ?huà)框 在C*App::InitINstance()中創(chuàng)...
- 今天的這幾個(gè)控件的中文名字,在網(wǎng)上查了半天,沒(méi)有找到統(tǒng)一的叫法,所以自己翻譯了一下:簡(jiǎn)易菜單對(duì)應(yīng)的是MD(Mate...
- 在上面的詞匯基礎(chǔ)上理解模態(tài)框的概念,它指的應(yīng)當(dāng)是「某種特定狀態(tài)下的窗體」。 但什么是「特定狀態(tài)下」?仍然有些難以理...
- 這里順便糾正了一個(gè)JavaScript的觀點(diǎn)for in循環(huán)中JavaScript循環(huán)的是 索引 而不是某個(gè)內(nèi)容