今天到武汉站的动车高铁 (今天到武汉站的高铁时刻表)

武汉娱乐 04-25 阅读:52 评论:0
今天到武汉站的动车高铁 (今天到武汉站的高铁时刻表)
车次 始发站 到达站 出发时间 到达时间
JavaScript 代码用于动态填充时刻表数据(示例): javascript // 假设时刻表数据存储在名为timetable 的数组中 const timetable = [{trainNumber: 'G1',fromStation: '北京西站',toStation: '武汉站',departureTime: '07:00',arrivalTime: '10:30'},{trainNumber: 'G5',fromStation: '上海虹桥站',toStation: '武汉站',departureTime: '08:30',arrivalTime: '11:50'},// ...其他时刻表数据 ];// 获取时刻表数据表格主体 const tbody = document.querySelector('tbody');// 遍历时刻表数据并创建行 timetable.forEach(train => {const newRow = document.createElement('tr');// 创建并填充列数据const trainNumberCell = document.createElement('td');trainNumberCell.textContent = train.trainNumber;const fromStationCell = document.createElement('td');fromStationCell.textContent = train.fromStation;const toStationCell = document.createElement('td');toStationCell.textContent = train.toStation;const departureTimeCell = document.createElement('td');departureTimeCell.textContent = train.departureTime;const arrivalTimeCell = document.createElement('td');arrivalTimeCell.textContent = train.arrivalTime;// 将列添加到行newRow.appendChild(trainNumberCell);newRow.appendChild(fromStationCell);newRow.appendChild(toStationCell);newRow.appendChild(departureTimeCell);newRow.appendChild(arrivalTimeCell);// 将行添加到表格主体tbody.appendChild(newRow); });
版权声明

本文仅代表作者观点,不代表武汉桑拿立场。
本文系作者授权发表,未经许可,不得转载。