Embedding a JavaScript Function : JavaScript in HTML « Development « JavaScript DHTML






Embedding a JavaScript Function


<html>
<head>
  <title>JavaScript Unleashed</title>
  <script type="text/javascript">
  <!--
    function displayMessage() {
      document.write("JavaScript functions<br>");
   
    }
  // -->
  </script>
</head>
<body>
  <script type="text/javascript">
  <!--
    document.write("Calling a JavaScript function...<p>");
    displayMessage();
    document.write("</p>Done. ");
  // -->
  </script>
</body>
</html>


           
       








Related examples in the same category

1.HTML comment that hides the script.
2.JavaScript Embedded in an HTML File
3.Using HTML Comments to Hide JavaScript Code
4.Embedding JavaScript in HTML
5.Inserting Source JavaScript Files
6.Using the Head for Definitions
7.A Basic JavaScript Starter Document
8.JavaScript Template File