![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
I am a javascript novice, but surely you need to tell the function toggleDetail that det is GLOBAL in scope? |
#2
| |||
| |||
|
|
On Jan 21, 5:08�pm, The Natural Philosopher <a...@b.c> wrote: I am a javascript novice, but surely you need to tell the function toggleDetail that det is GLOBAL in scope? Declaring a var like that outside of any function makes it global. Using the var keyword inside any function makes it local. Skipping the var keyword altogether will also make it global. In javascript you could declare and initialize a variable inside a function like so: function someFunction(){ det = false; } and det will be a global. |
#3
| |||
| |||
|
|
Thanks for that. I guess I should have remembered it all started as some sort of BASIC. And would therefore break most of the rules of structured programming before it got round to trying to add them all back again. With C, there was one slim book, that almost completely defined the language. With Javascript, I have a book 4" thick that doesn't even really define anything. Sigh. |
![]() |
| Thread Tools | |
| Display Modes | |
| |