[Proto-Scripty] Re: Javascript scope

2009-02-12 Thread T.J. Crowder
Hi again Doug, But, my question is, is there a way I can do some type of alert() and have it print out what scope it is executing in? I don't know of a reliable way to do that, no. But if you're using Firefox, it looks like the latest Firebug[1] now displays the scope chain on the watch

[Proto-Scripty] Re: Javascript scope

2009-02-12 Thread RobG
On Feb 11, 11:21 am, doug douglass_da...@earthlink.net wrote: I have read about Javascript and scope and I still don't really understand it completely, particularly when it comes to Ajax.Updater. I don't really understand, for example why, if there is a variable window.myvar, some

[Proto-Scripty] Re: Javascript scope

2009-02-11 Thread T.J. Crowder
Hi Doug, I don't really understand, for example why, if there is a variable window.myvar, some Javascript code would not be able to access it... As far as I know, all code within the same document can access that property; it is global to the document because it's a property of the window

[Proto-Scripty] Re: Javascript scope

2009-02-11 Thread doug
Thanks for the advice every one. T. J. Crowder, I wonder if a div with style overflow:auto and a scrollbar on the side could act similar to a frame. I figured what makes things go wrong, but still not sure why. I bring up a lightbox similar to the one here:

[Proto-Scripty] Re: Javascript scope

2009-02-11 Thread T.J. Crowder
Hi, I wonder if a div with style overflow:auto and a scrollbar on the side could act similar to a frame. It shouldn't, no. But, when I do an Ajax.Update of the lightbox div, and I have an onclick on a button in that lightbox. The code attached to that button can longer access the global

[Proto-Scripty] Re: Javascript scope

2009-02-11 Thread david
Hi doug, Yes, give us a live demo, if possible. But what I read let me think that you would access to a variable in the main window from javascript coded inside a frame. This is possible but under certain restrictions for security reasons. Is that what you trying to do?? -- david On 11 fév,

[Proto-Scripty] Re: Javascript scope

2009-02-10 Thread joneff
Basically every set of curly braces {} gives you new scope. It does (give you) with functions and objects, but i am not sure if it does for for, while etc. The this is different for every level of scope but not every scope (since it points to the current object). Examine this code window.ppp =

[Proto-Scripty] Re: Javascript scope

2009-02-10 Thread seasoup
Basically every set of curly braces {} gives you new scope. This is one of the most confusing aspects of javascript. The above is not true. There are only two scopes in javascript, global and function () {} var a = 'hi'; for (var b = 0; b 10; b++) { alert(a); // alerts 'hi' }