JavaScript 函数构造方法


JavaScript 函数构造方法

<html>
   <head>

      <script type = "text/javascript">
         <!--
            var func = new Function("x", "y", "return x*y;");
            function secondFunction() {
               var result;
               result = func(10,20);
               document.write ( result );
            }
         //-->
      </script>

   </head>
   <body>
      <p>Click the following button to call the function</p>

      <form>
         <input type = "button" onclick = "secondFunction()" value = "Call Function">
      </form>

      <p>Use different parameters inside the function and then try...</p>

   </body>
</html>