Monday, May 10, 2010

A Simple Button Click Function Call

Step 1. Put a function anywhere between the HEAD tags of your web page:
<script type="text/javascript">
  <!–
    function helloWorld() {
      alert(‘Hello World!’) ;
    }
  // –>
  </script>
Step 2. Somewhere between the BODY tags, make a button that calls the above function.
<input type="button" id="hello-world2" value="Hello" onClick="helloWorld();" />

No comments:

Post a Comment