January 2001
Beginner
312 pages
6h 4m
English
You've seen how events can be used to trigger functions, but what about one function triggering another? That's simple! Here is an example of a function that contains an alert box triggered by the onLoad event and that triggered another function itself:
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!-- Cloaking device on!
function firstMessage()
{
alert("Here is the first message!");
secondMessage();
}
function secondMessage()
{
alert("And here is the second!");
}
// Cloaking device off -->
</script>
</head>
<body onLoad="firstMessage()">
</body>
</html>
When you load this page into the browser, the onLoad event triggers the function firstMessage(), which displays the first alert box ...
Read now
Unlock full access