posts - 495,  comments - 11,  trackbacks - 0
<html>
    <head>
      <title>Examples of the var Keyword</title>
    <script language="JavaScript">
    <!--
    var myVar = "Global";

    function myFunc(){
      var myVar = "Function";
      return myVar;
    }

    function mySecFunc(){
      var myVar = "Second Function";
      document.write("<br>The value of myVar when called by mySecFunc() is: ");
      document.write(myVar);
    }
    -->
    </script>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    document.write("The value of myVar when called is: " + myVar)

    document.write("<br>The value of myVar when called by myFunc() is: ");

    document.write(myFunc());

    mySecFunc();

    -->
    </script>
    </body>
    </html>

posted on 2007-09-25 11:32 jadmin 阅读(40) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: