HighDots Forums  

Re: Global variable not remembering value

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Global variable not remembering value in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeremy J Starcher
 
Posts: n/a

Default Re: Global variable not remembering value - 01-21-2008 , 06:28 PM






On Mon, 21 Jan 2008 23:08:27 +0000, The Natural Philosopher wrote:

Quote:
I am a javascript novice, but surely you need to tell the function
toggleDetail that det is GLOBAL in scope?
You really should read the specs on Javascript. All variables not
declared in a function become global. (*)

(*) To be more precise, they become elements on the super "global"
object that in web browser UAs "window" points to.


Quote:
There's probably a way to do that in Java shit too.
Javascript is NOT C, or PHP nor any other language. Do not deride
it for being something it is not.

Every language has little quirks that make you want to pull your
hair out. No language is perfect and there are none that I"ve coded
in that I haven't sworn at.

Quote:


* 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 are not even talking about Javascript. You are referring to
the DOM, something which Javascript can access. They are tightly coupled
in most UAs, but not the same thing.

SPANS can have ID's.

InnerHTML has many known issues and is not part of the standard DOM
(yet). Unless one knows its limitations, it is best not to use it.

Quote:
Now you know why I call it Javashit. Its never the same syntax twice..
There are a large number of people who have done very well coding in
Javascript, and do not have to re-invent the wheel each time. Don't FIGHT
the language. Use it as should be used.

Personal note:
The first three or four languages I learned really cheesed me off, because
each one was so different from the other. Each paradyne shift has taught
me something taught me new and creative ways to curse.


Reply With Quote
  #2  
Old   
webmasterATflymagnetic.com
 
Posts: n/a

Default Re: Global variable not remembering value - 01-21-2008 , 07:04 PM






Thanks to everyone who have responded. I'm now a happy bunny as I have
a way forward.

Cheers!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.