Advertisement
iTA360

Download Time Calculator

Jul 24th, 2023 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. Download time Calculator html code not need java or css can work offline create txt file on pc rename it html
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>Davide Spagocci Download Time Calculator internet Files GB Mbps</title>
  7. </head>
  8. <body>
  9. <h1>Davide Spagocci Download Time Calculator internet Files GB Mbps</h1>
  10. <form>
  11. <label for="file-size">File Size (GB):</label>
  12. <input type="number" id="file-size" step="0.1" required>
  13. <br>
  14. <label for="download-speed">Download Speed (Mbps):</label>
  15. <input type="number" id="download-speed" step="0.1" required>
  16. <br>
  17. <button type="button" onclick="calculateDownloadTime()">Calculate</button>
  18. </form>
  19. <div id="result"></div>
  20.  
  21. <script>
  22. function calculateDownloadTime() {
  23. var fileSize = parseFloat(document.getElementById("file-size").value);
  24. var downloadSpeed = parseFloat(document.getElementById("download-speed").value);
  25.  
  26. var downloadTime = fileSize * 1024 / (downloadSpeed / 8);
  27. var hours = Math.floor(downloadTime / 3600);
  28. var minutes = Math.floor((downloadTime % 3600) / 60);
  29. var seconds = Math.floor(downloadTime % 60);
  30.  
  31. var result = document.getElementById("result");
  32. result.innerHTML = "Download Time: " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds";
  33. }
  34. </script>
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement