January 2001
Beginner
312 pages
6h 4m
English
You can use parameters to pass data from one function (the referring function) to another (the receiving function).
Here is a simple example of this in action:
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!-- Cloaking device on!
function first()
{
var x = 3, y = 5;
doAdd(x, y);
}
function doAdd(x, y)
{
alert(x + y);
}
// Cloaking device off -->
</script>
</head>
<body onLoad="first()">
</body>
</html>
In this example, the referring function (first()) is passing x and y to the parameters in the receiving function (doAdd()), which performs the math and outputs the answer.
This might seem of dubious value to you now (why not do the math in the first function and not have the second ...
Read now
Unlock full access