如何在警报框中调用JavaScript函数?

要在警报框中调用JavaScript函数,您可以尝试运行以下代码-

示例

<!DOCTYPE html>
<html>
   <body>
      <script>
         function myFunction(warning) {
            alert(warning);
            catchedAlert();
         }
         function catchedAlert() {
            alert('Alert called!');
         }
      </script>
      <button onclick="myFunction('This is an alert box!')">Click me!</button>
   </body>
</html>