Comment from Russell Bicknell
Global variables are actually the default in JavaScript. The keyword var is actually what causes the variable you are assigning to be placed in the local scope. If you want to declare a variable in the...
View ArticleComment from Jonathan Snook
@Endel, that's correct. It is not possible to directly share variables between frames from different domains. There are ways around it, such as using Flash with properly configured crossdomain.xml...
View ArticleComment from Endel
Hello there, I get stuck about sharing variables between frames from different domains. It's impossible, right?
View ArticleComment from Rakesh
Hello, I found this post usefull,.. .and then began to think how to delete the variable from the window object.. and i came across "delete" delete window.myValue; alert(window.myValue); // undefined
View ArticleComment from HH
try this(repair '['): [script type="text/javascript"> function aaa(){alert('aaa'+globvar);}//this works [/script> [script type="text/javascript"> var globvar=123; aaa(); zzz(); [/script>...
View ArticleComment from Karim
Hello Everyone, Although this is an old discussion but I would also like to ask question same as above. As if you have declared global variable and assigned it locally within a function, is it possible...
View ArticleComment from Shahzad
I am looking for a global variable that is inter-script accessible. Something like:< script language="JavaScript"> var interscriptVariable = 0;< /script>< script...
View ArticleComment from Test
text but other than thattestvoid <script language="javascript">alert('hello')</script>
View ArticleComment from Richard
Jonathan, After reading your response yesterday I broke out a Javascript book and read up on ajax. I also found an article you did on webreference.com which I found to be very helpful. I had some miss...
View ArticleComment from Jonathan Snook
@Richard: based on your description of this ActiveX object, it seems like you need the ocx to be continually loaded. Going Ajax may be fairly quick depending on how you have things structured now. For...
View ArticleComment from Richard
Jonathan - Thanks for the response! It's an AcitveX Object (.ocx) that implements a VIOP phone system on the client side so persisting the object in either cookies or at the server wont work in my...
View ArticleComment from Jonathan Snook
@Richard: that's a definite dilemma and you've got a few things you can do:Use cookies to store state from page to pagesend the state information back to the server and include it in the rendered...
View ArticleComment from Richard
Hi guys, I am an experienced developer with just a basic understanding of Javascript (enough to do client validation etc) but for the most part, most of my dev is on the server side. My question: I...
View ArticleComment from Roger
I admit to being a novice with JavaScript, but... so far, not a single example that I've found on Google of changing a value of a global var by means of a function has ever worked.
View ArticleComment from Jonathan Snook
You can always contain your code down to just one global variable. In the case of this site, all my custom code is contained in the SNOOK variable.
View ArticleComment from Mr. Ignition
Global variables are hard too avoid in JavaScript. People can say they're bad and all but who here can look at the source for their site and not have any global JS variables?
View ArticleComment from dj
How can you avoid using so-called globals in situations like this ... For instance, I have an array of values that I need for some widget on the page. The user can click a button and retrieve new...
View ArticleComment from FYRe
With declared global variables, how do I set them as an id for (Eg. a checkbox). ---------------------------------------------- eg: <script language="JavaScript"> var num1 = 0; function...
View ArticleComment from Garrett
David - You're right, but I still shy away from them because I tend to lean on the side of purist. Plus, as everybody is getting on the AJAX bandwagon, pages can get fairly complex, and even only being...
View ArticleComment from David ODonnell
Garrett, what you say is generally true for server-side programming languages, but in javascript nothing is really "global" because they are only in scope for the lifetime of the page. @jonathan - i...
View ArticleComment from Garrett Dimon
Not to be overly pedantic, but global variables should kind of be a last resort. This is the case with almost any programming language really. It's kind of like playing with fire. This isn't meant to...
View ArticleComment from Jonathan Fenocchi
Other tips? Seldom, if ever, is the eval() method necessary. I see people using it all the time to declare variables, and while I would much rather use an array, if you really find it necessary to...
View Article