c-router-emulator/www/arp.html

46 lines
1.3 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="zifan">
<meta name="keywords" content="物联网">
<title>ARP列表</title>
</head>
<body>
<table id="arpTable" width="700" align="center" border="1">
<thead>
<th>ID</th>
<th>ip地址</th>
<th>mac地址</th>
</thead>
<tbody id="arpTableBody" align="center">
</tbody>
</table>
<script>
window.onload = function () {
fetch("/cgi-bin/ip.cgi").then(resp => resp.json()).then(data => {
if (data.code == 0) {
arpTableBody.innerText = "";
data.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>