Re: Help with naming elements in a loop
- From: "Richard Cornford" <Richard@xxxxxxxxxxxxxxxxxxx>
- Date: 15 Aug 2006 05:22:43 -0700
Erwin Moller wrote:
Ed Jay wrote:<snip>
<snip>The functions show('target') and hide('target') are simple js functions,
i.e., : document.getElementById(target).style.display = "" //(or "none")
I am unsure if the empty string is a valid value for display.
An empty string is a valid value to assign to any property of an
element's - style - object that is expecting a string type (almost all
except zIndex). As the - style - object reflects the values assigned
using the STYLE attribute in HTML assigning an empty string is
equivalent to removing a CSS declaration from the STYLE attribute, so
the applied style becomes those derived from external style sheets or
the browser's default.
Assigning an empty string is in fact a useful facility where specific
elements have various values depending on the browser. For example, a
TD element may be - display:table-cell; - on modern browsers and -
display:block - on IE, and setting 'block' were 'table-cell' is
expected produces unexpected effects. So switching a TD from -
display:none; - to a state where it is displayed either requires
knowing (or working out) which value actually applies on the browser in
question, or assigning a value that removes the 'none' value and allows
the element to revert to its default. for which an empty string is an
ideal value.
You usually use document.images.etc to address images.<snip>
Or when they are labeled with an id, getElementById().
The W3C HTML DOM specification requires that IMG elements can be
referenced in the document.images collection with their ID attributes
as well as by NAME attribute. So even if the IMG only has an ID
attribute it is still not necessary to use - getElementById -.
Richard.
.
- References:
- Help with naming elements in a loop
- From: Ed Jay
- Re: Help with naming elements in a loop
- From: Erwin Moller
- Help with naming elements in a loop
- Prev by Date: Re: Help with naming elements in a loop
- Next by Date: Re: want to make an action listener in javascript
- Previous by thread: Re: Help with naming elements in a loop
- Next by thread: Re: Help with naming elements in a loop
- Index(es):
Relevant Pages
|