|
-
Mar 29th, 2012, 05:40 AM
#1
Thread Starter
Lively Member
Accessing global variables across multiple js files
I have one js file, i declare a global variable called bigvar
var bigvar = ""
Now i use jquery to import another js file
&.getscript("myscript.js");
Now in the myscript there is a function called setbigvar()
function setbigvar(value)
{
bigvar=value;
}
Now I call setbigvar() from my first js file.
setbigvar("New value!");
Then the value of bigvar is drawn on screen, but it still = ""
why is this.
How can my imported script myscript.js use variables in the first js file and vice versa maybe??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|