Advertisement
rutera

Click the button

Dec 25th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p id="demo">Click the button to return the number of characters in the string "Hello World!".</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <script>
  10. function myFunction()
  11. {
  12. var str= prompt("My name:");
  13. var n=str.length;
  14. document.getElementById("demo").innerHTML=n;
  15. }
  16. </script>
  17.  
  18. </body>
  19. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement