该方案增加了表行for each客户端和内部的table row,一个td客户端的每一个值(如姓名,IP,值等)。这些值和客户端设置在一个key/value object或dictionary称为clientel.
我已将程序设置如下:
let clientel = {
socket101: ['Rick', '192.590.49.1', 'Win10', 'Norway', '15:49.00'],
socket102: ['Anthony', '192.90.897.0', 'Win7', 'Negritine', '19:19:38']
};
function man_table() {
const table = document.getElementById('table-body');
for (let i, client in clientel) {
let row = table.insertRow(i);
let index = row.insertCell(0);
let name = row.insertCell(1);
let ip = row.insertCell(2);
let os = row.insertCell(3);
let country = row.insertCell(4);
let timee = row.insertCell(5);
index.innerHTML = i;
name.innerHTML = client[0];
ip.innerHTML = client[1];
os.innerHTML = client[2];
country.innerHTML = client[3];
timee.innerHTML = client[4];
}
};
function roomba() {
for (let client in clientel) {
console.log(client)
}
};
我有按 em' 时执行功能的按钮,但出于某种原因,它说clientel未定义?
人到中年有点甜
慕斯王
随时随地看视频慕课网APP
相关分类