-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathping.html
More file actions
84 lines (75 loc) · 3.2 KB
/
ping.html
File metadata and controls
84 lines (75 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ping Test | Troubleshoot Chatbot</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div class="container">
<div class="decor circle1"></div>
<div class="decor circle2"></div>
<h1>Ping Test</h1>
<div class="tool-container">
<div class="tool-description">
<p>Ping test checks the reachability of a host on an IP network and measures the round-trip time for messages.</p>
</div>
<div class="tool-interface">
<div class="input-group">
<input type="text" id="ping-host" placeholder="Enter host or IP" value="google.com">
<button id="ping-btn">
<i class="fas fa-play"></i> Run Ping
</button>
</div>
<div class="result-container">
<div class="result-header">
<h3>Results</h3>
<div class="result-actions">
<button id="copy-ping"><i class="fas fa-copy"></i></button>
<button id="clear-ping"><i class="fas fa-trash"></i></button>
</div>
</div>
<div class="result-output" id="ping-result"></div>
</div>
</div>
<a href="index.html" class="back-btn">
<i class="fas fa-arrow-left"></i> Back to Main
</a>
</div>
</div>
<script>
document.getElementById('ping-btn').addEventListener('click', async function() {
const host = document.getElementById('ping-host').value;
const resultDiv = document.getElementById('ping-result');
resultDiv.textContent = 'Testing...';
try {
// In a real implementation, you would call your backend API
// For demo purposes, we'll simulate a response
setTimeout(() => {
resultDiv.textContent = `Pinging ${host} [142.250.190.46] with 32 bytes of data:
Reply from 142.250.190.46: bytes=32 time=12ms TTL=117
Reply from 142.250.190.46: bytes=32 time=11ms TTL=117
Reply from 142.250.190.46: bytes=32 time=13ms TTL=117
Reply from 142.250.190.46: bytes=32 time=14ms TTL=117
Ping statistics for 142.250.190.46:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 11ms, Maximum = 14ms, Average = 12ms`;
}, 1000);
} catch (error) {
resultDiv.textContent = `Error: ${error.message}`;
}
});
// Copy and clear functionality
document.getElementById('copy-ping').addEventListener('click', function() {
const result = document.getElementById('ping-result').textContent;
navigator.clipboard.writeText(result);
});
document.getElementById('clear-ping').addEventListener('click', function() {
document.getElementById('ping-result').textContent = '';
});
</script>
</body>
</html>