c-router-emulator/www/arp.html

68 lines
1.7 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="zifan">
<meta name="keywords" content="物联网">
<title>ARP列表</title>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 50px;
}
#arpTable {
background-color: rgba(41, 117, 117, 0.667);
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<div class="tablecenter">
<table id="arpTable" width="700" align="center" border="1" cellspacing="0">
<thead>
<th>ID</th>
<th>ip地址</th>
<th>mac地址</th>
</thead>
<tbody id="arpTableBody" align="center">
</tbody>
</table>
</div>
<script>
window.onload = function () {
fetch("/cgi-bin/arp.cgi").then(resp => resp.json()).then(data => {
arpTableBody.innerText = "";
data.forEach(rowData => {
let tr = document.createElement("tr");
let td1 = document.createElement("td");
let td2 = document.createElement("td");
let td3 = document.createElement("td");
td1.innerText = rowData.id;
td2.innerText = rowData.ip;
td3.innerText = rowData.mac;
tr.append(td1, td2, td3);
arpTableBody.append(tr);
});
}
)
}
</script>
</body>
</html>