bscofield wrote:
I have 4 *.js files that I am referring to with <script src=*.js></script>
call the files A, B, C, and D.
From file "A" I can view and use variable "Data1" from file "D".
From file "B" I CANNOT view nor use variable "Data1" from file "D".
What's up with that?
Any ideas...?
When it comes to scripting, all of your includes are sequential.
This means that A is loaded and executed before B is, which is loaded
before C is, etc.
If the code is written so it is executed inline in B, then it cannot see
something declared in D. If the code is written so it is executed as an
event in A, then there is a good chance D has been loaded, and it exists.
Here is an example of what I mean... immagine the 4 scripts are all inline:
///// File A.js
function test() {
alert(JunkFromD);
}
///// File B.js
alert(JunkFromD);
///// File C.js
/// whatever
///// File D.js
var JunkFromD = "THIS IS A TEST";
......
<button onClick="test()">Click Me</button>
So, in this case, a the function test() in file A.js does not get
called, until after D.js is defined, so JunkFromD exists. (In the Button
click)
In file B.js, you are executing the statement immediately, so JunkFromD
has not yet been created.
Note, that this is just a Wild Ass Guess to what the issue is. Without
seeing the code, it is almost impossible to tell for sure.
I hope this helps,
Brian