arp表中添加黑名单显示

This commit is contained in:
zifan 2023-09-23 14:00:26 +08:00
parent 8e27a9484d
commit a21e259272
1 changed files with 39 additions and 3 deletions

View File

@ -42,8 +42,31 @@
</tbody>
</table>
</div>
<div style="display: none;">
<table id="balckTable" width="250" align="center" border="1" cellspacing="0">
<thead>
<th>ip地址</th>
</thead>
<tbody id="blackTableBody" align="center">
</tbody>
</table>
</div>
<script>
window.onload = function () {
var blackData;
function loadBlackData() {
fetch("/cgi-bin/fw.cgi").then(resp => resp.json()).then(data => {
blackData = data;
loadData();
})
}
function loadData() {
fetch("/cgi-bin/arp.cgi").then(resp => resp.json()).then(data => {
arpTableBody.innerText = "";
data.forEach(rowData => {
@ -57,10 +80,23 @@
td3.innerText = rowData.mac;
tr.append(td1, td2, td3);
for (let i = 0; i < blackData.length; i++) {
if (blackData[i].ip == rowData.ip) {
tr.style = "color:red;";
break;
}
}
arpTableBody.append(tr);
});
})
}
)
window.onload = function () {
loadBlackData();
}
</script>
</body>