![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| ||||
| ||||
|
|
webmasterATflymagnetic.com wrote: I would be grateful for some pointers to the code below. I want to click the button and it toggles the showing of text. The state is tracked in the variable det. Whilst the function itself works, I have two questions: * Why does it not 'stick' with the new value (ie det = true), but keep reverting to the false value? I am a javascript novice, but surely you need to tell the function toggleDetail that det is GLOBAL in scope? |
|
In C that would be *'external', from memory, in PHP its 'global'.. In C I would declare det as a 'static' variable INSIDE the function.. There's probably a way to do that in Java shit too. |
|
* Why does it work even more poorly in IE? *The line with getElementById() in particular seems not to rewrite the HTML. I THINK I met this befre, SPANS can't have ID's - only DIVS can or something. Or is it that they cant have inerHTML. |
|
Now you know why I call it Javashit. Its never the same syntax twice.. |
![]() |
| Thread Tools | |
| Display Modes | |
| |