Page is a not externally linkable
sssweb - 4:44 pm on Dec 4, 2012 (gmt 0)
<!DOCTYPE...>
<html...>
<head>
...
<script type="text/javascript" src="external_file.js"></script>
<script type="text/javascript">
function func1(){..., callback: func2;}
function func3(){...}
</script>
[external_file.js]
function func2(){..., callback: func3;}
func1 & func2 run fine; func3 does not. I can put it in the external file if req'd, but just want to understand the scripting rules here. I thought the browser parses all code, including external files, then executes, so that sequence doesn't matter. Apparently, that's wrong.
Strangely(?): If I put the external file ref AFTER the script, func2 runs (even though it hasn't yet been defined when called in the main script). Plus, other functions in my external file don't run from calls in that same file (even though they run fine in the first setup). So the script never even gets around to returning to func3 on my HTML page (my external file has more to it than indicated above; it's more like func2 => cycle thru func2a a few times => then return to func3 on the main page).