长沙公交车实时到站查询233 (长沙公交车实时到站查询)
长沙耍耍
05-30
阅读:41
评论:0
![](/gg/hf11.gif)
请输入公交车线路和站点名称,即可查询实时到站信息。
style.css css body {font-family: Arial, sans-serif; }h1 {font-size: 24px;margin-bottom: 10px; }p {font-size: 16px;margin-bottom: 10px; }form {margin-bottom: 10px; }label {margin-right: 5px; }input {width: 200px;padding: 5px;margin-right: 5px; }result {background-color: eee;padding: 10px;margin-top: 10px;display: none; }script.js javascript const form = document.querySelector('form'); const result = document.querySelector('result');form.addEventListener('submit', (e) => {e.preventDefault();const line = document.querySelector('input[name="line"]').value;const station = document.querySelector('input[name="station"]').value;if (!line || !station) {alert('请输入公交车线路和站点名称');return;}const url = `query.php?line=${line}&station=${station}`;fetch(url).then(response => response.json()).then(data => {if (data.error) {alert(data.error);return;}let html = `![长沙公交车实时到站查询233 (长沙公交车实时到站查询)](https://tgirlmeat.com/thumb/20240530043652_61598.jpg)
${line}路 ${station}站
`;html += '-
';for (const bus of data.buses) {html += `
- ${bus.name} ${bus.time}分钟后到站 `;}html += '
版权声明
本文仅代表作者观点,不代表长沙桑拿立场。
本文系作者授权发表,未经许可,不得转载。