Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <p id="demo">Click the button to return the number of characters in the string "Hello World!".</p>
- <button onclick="myFunction()">Try it</button>
- <script>
- function myFunction()
- {
- var str= prompt("My name:");
- var n=str.length;
- document.getElementById("demo").innerHTML=n;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement