SpeedTest Checker Tool
Internet SpeedTest Checker
Click the button below to check your internet speed:
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #1e3c72, #2a5298);
color: #fff;
}
.container {
text-align: center;
background: #ffffff30;
padding: 20px;
border-radius: 15px;
width: 90%;
max-width: 500px;
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
}
h1 {
font-size: 2rem;
margin-bottom: 10px;
color: #ffdd57;
}
button {
background-color: #28a745;
color: white;
border: none;
padding: 10px 20px;
font-size: 1rem;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #218838;
}
.results {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.results div {
text-align: center;
background: rgba(0, 0, 0, 0.3);
padding: 15px;
border-radius: 10px;
width: 30%;
color: #ffdd57;
}
p {
font-size: 1.5rem;
margin: 10px 0 0;
color: #ffffff;
}
@media (max-width: 600px) {
.results {
flex-direction: column;
gap: 15px;
}
.results div {
width: 100%;
}
}
document.getElementById("startTest").addEventListener("click", function () {
// Mock speed test simulation (Replace with actual API or library for live results)
const mockSpeedTest = () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
download: (Math.random() * 100).toFixed(2),
upload: (Math.random() * 50).toFixed(2),
ping: (Math.random() * 100).toFixed(2),
});
}, 2000);
});
};
// Display "testing" animation
document.getElementById("download").innerText = "Testing...";
document.getElementById("upload").innerText = "Testing...";
document.getElementById("ping").innerText = "Testing...";
// Fetch and display the results
mockSpeedTest().then((result) => {
document.getElementById("download").innerText = `${result.download} Mbps`;
document.getElementById("upload").innerText = `${result.upload} Mbps`;
document.getElementById("ping").innerText = `${result.ping} ms`;
});
});
0 Comments