Defining and Using Functions - Javascript Language Basics

Javascript examples for Language Basics:Introduction

Introduction

Defining a JavaScript Function

Demo Code

ResultView the demo in separate window

      <!DOCTYPE HTML>
      <html>
          <head>
              <title>Example</title>
          </head>
          <body>
              <script type="text/javascript">
            function myFunc() {//  w  w  w  . j a v  a2  s  . c  om
                document.writeln("This is a statement");
            };

            myFunc();
        </script>
    </body>
</html>

Related Tutorials