如何调用JavaScript函数作为函数?

要将JavaScript函数作为函数调用,请像普通的自定义JavaScript函数一样调用它。

示例

您可以尝试运行以下代码以将JavaScript函数作为函数调用-

<html>
   <head>
      <script>
         function Display()         {
            document.write ("你好,世界!");
         }
      </script>
   </head>
 
   <body>
      <p>Click the following button to call the function</p>
      <form>
         <input type = "button" onclick = "Display()" value = "Display">
      </form>
   </body>
</html>