hafizarslan
New Member
I have a couple of JavaScript functions that I would like to reuse on multiple different pages, so I created an external .js file for the functions. I was wondering if it was possible to change the global variables of that javascript without changing the actual .js file. Here's an example of what I mean:Suppose I have this tag for my external JavaScript: \[code\]<script src="http://stackoverflow.com/questions/14046490/myscripts.js"></script>\[/code\]Could I somehow define the global variables for the scripts in the \[code\]<script>\[/code\] tag like so? \[code\]<script src="http://stackoverflow.com/questions/14046490/myscripts.js"> sampleglobalvariable = "somevalue"; sampleglobalvariable2 = "somevalue2";</script>\[/code\]Or like so?\[code\]<script src="http://stackoverflow.com/questions/14046490/myscripts.js"></script><script> sampleglobalvariable = "somevalue"; sampleglobalvariable2 = "somevalue2";</script>\[/code\]Or would I have to define them inside the actual \[code\]myscripts.js\[/code\] file?