Passing a variable to an external JS file?

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Passing a variable to an external JS file?

Post by VladSun »

Good idea, Weirdan.
The only issue I see is that the script should somehow identify itself (i.e. its own script tag)
One may use the script tag source - not good, file name coupling.
One may use a script tag ID - better.
One may use the first line (e.g.) to identify it by using the innerHTML property.

Code: Select all

SCRIPTID = 20
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply