Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Calling a Function</title>
- </head>
- <body>
- <h1>Calling a Function</h1>
- <p id="myPar">I am a paragraph</p>
- <div id="myDiv">I am a div</div>
- <p>
- <button type="button" onclick="myFunction()">Change</button>
- </p>
- <script>
- function myFunction() {
- document.getElementById("myPar").innerHTML = "Hello!!";
- document.getElementById("myDiv").innerHTML = "How are you??";
- }
- </script>
- <p>When you click the change button, the elements will change.</p>
- <p>this is how you call a function.</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement