05-25-2005, 12:57 AM
Hi, I'm having trouble opening an external JS file to be executed as an array.
For example the following DOES NOT WORK:
What is wrong with this and why is it not pulling up the external file?
Thanks in adavance.
an array can be:
var whatever =[string]
var whatever = new Array(string)
var whatever = new Array()
whatever = string;
What is your goal, anyway?
05-25-2005, 05:02 PM
External JS files are simply files that contain JS that is executed when it is called. You cannot, for example, put specific data into a JS file and then expect it to load as that data into whatever value you specify.
If you want to include an array from an external file, then you must include that array as code in the external file. If you want to change the name of the array, then you can just re-assign the array to another variable.
whatever = new Array();
whatever = "Hi mom!";
whatever = "...";
And then include it SIMPLY with a script tag:
Now after that is called, the variable "whatever" is the array.
If (for some reason) you wanted the array to take on whatever variable name you wanted, then you would do the exact same for the external file, but then you would assign the new variable to the array variable. Like so:
some_variable = whatever;
Now "some_variable" is equal to the array.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.