C
Chris
Hello,
Calling a function always works when the invocation is placed AFTER
the function-definition.
But what if the invoke-statement is placed BEFORE it ?
I thought it shouldn't work but apparently ... in some cases it works,
in other cases it doesn't
as illustrated in following example.
<html>
<head>
<title>Functions</title>
<script type="text/javascript">
Greet("Fred");
</script>
<script type="text/javascript">
Greet("Ethel");
function Greet(who) {
alert("Greetings, " + who);
}
</script>
</head>
<body>
<h1>
Function Example</h1>
</body>
</html>
Greet("Ethel") works fine but Greet("Fred"); doesn't work.
Both invocations are placed BEFORE the function-definition but
apparently it is not the determining factor.
Is it because they are placed in different <script> tags? if so, why
then?
thank you
Chris
Calling a function always works when the invocation is placed AFTER
the function-definition.
But what if the invoke-statement is placed BEFORE it ?
I thought it shouldn't work but apparently ... in some cases it works,
in other cases it doesn't
as illustrated in following example.
<html>
<head>
<title>Functions</title>
<script type="text/javascript">
Greet("Fred");
</script>
<script type="text/javascript">
Greet("Ethel");
function Greet(who) {
alert("Greetings, " + who);
}
</script>
</head>
<body>
<h1>
Function Example</h1>
</body>
</html>
Greet("Ethel") works fine but Greet("Fred"); doesn't work.
Both invocations are placed BEFORE the function-definition but
apparently it is not the determining factor.
Is it because they are placed in different <script> tags? if so, why
then?
thank you
Chris