Advertisement
TheChosenCheese

Random Code

Nov 16th, 2016
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.85 KB | None | 0 0
  1. <html>
  2. <title>Length Calculator</title>
  3. <body>
  4. <label><a href ="Missions Diary.html">Mission Diary</a></label>
  5. <script type="text/javascript">
  6. function reload() {
  7. location.reload();
  8. }
  9. function le() {
  10. var x = prompt("Type here the string *the length will include spaces too.", "")
  11. var y = prompt("Type here the number of chars *including spaces* that you want that's the length won't include.", "Type letters as the number of chars that you want to delete. Example: i want to delete 3 letters so: aaa")
  12. var z = x.length - y.length
  13. if(confirm("The length of ths string is: " + z)) {
  14. reload();
  15. }
  16. }
  17.  
  18. </script>
  19. <p><b>To find the length of the string</b></p>
  20. <form>
  21. <input type="button" value="Click here" onClick="le()">
  22. </form>
  23. <p><b>To refresh the page</b></p>
  24. <form>
  25. <input type="button" value="Click here" onClick="reload()">
  26. </form>
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement