경고 상자에서 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>