Reputation: 1167
I'm working on a project with C# in ASP.NET and using the JavaScript Library Raphael.
I have created some circles that I want to have as global variables to be able to modify their position as certain events happen. where should I define the global variables?
also I have two different .js files with functions and want to call one function from a button
OnClientClick="return doSomething();"
Do I need to mention the file name there?
Upvotes: 1
Views: 6163
Reputation: 30993
You can define your global var inside a tag but outside any function for example in the head section of the page ; in this way you get variables accessible from everywhere in your page.
Function name must be unique, for included js script too, for call a js function your example is right.
Upvotes: 3