Click to See Complete Forum and Search --> : Using Variables in script src


druss
01-24-2003, 11:59 PM
i have a set of variables in a javascript file called var.js

now there is another javascript file called write.js and in there has the names of the variables set in var.js

however nothing seems to happen??

for example.

This is var.js:
A = 'blah';


Now this is write.js:
document.write(A);

it wont write A, so i was wondering if it was even possible?


Thanks
Goran

Nedals
01-25-2003, 12:05 AM
Hi again!
You may have a timing problem.
document.write(A) will need to occure after the doc has loaded which may defeat what you are trying to do.

khalidali63
01-25-2003, 08:26 AM
Errors of this sort(assuming definition and declarations are correct) are normally caused by logical errors.
in the html page the import statement for var.js script must precede the
import statement for write.js.
1. definition/declaration first
2.then usage.

Khalid