Advertisement
virtualideaz

CallingAFunction.html

Apr 4th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.     <title>Calling a Function</title>
  4. </head>
  5. <body>
  6.     <h1>Calling a Function</h1>
  7.    
  8.     <p id="myPar">I am a paragraph</p>
  9.     <div id="myDiv">I am a div</div>
  10.    
  11.     <p>
  12.         <button type="button" onclick="myFunction()">Change</button>
  13.     </p>
  14.    
  15.     <script>
  16.         function myFunction() {
  17.             document.getElementById("myPar").innerHTML = "Hello!!";
  18.             document.getElementById("myDiv").innerHTML = "How are you??";
  19.         }
  20.     </script>
  21.    
  22.     <p>When you click the change button, the elements will change.</p>
  23.     <p>this is how you call a function.</p>
  24.  
  25. </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement