Re: Help with naming elements in a loop



Erwin Moller wrote:
Ed Jay wrote:
<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.
<snip>

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.
Or when they are labeled with an id, getElementById().
<snip>

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.

.



Relevant Pages

  • Re: Strange behavior
    ... Rather than assigning the empty string to the Value property, ... Whether that will solve your problem or not, I don't know (hyperlinks are ... If you don't mind deleting ...
    (microsoft.public.excel.programming)
  • Re: Strange behavior
    ... cleared the contents of three cells. ... Rather than assigning the empty string to the Value property, a better way to clear the contents of a cell would be to use the ClearContents property instead... ... If you don't mind deleting formatting and all, you could just use the Clear property... ...
    (microsoft.public.excel.programming)
  • Re: string = "" or = string.Empty?
    ... And if FxCop is to be believed this is actually the most efficient way -- but it's only applicable if you know the value isn't null. ... Assigning either "" or String.Empty should make no difference whatsoever (and in this case, unlike empty string testing, I think it actually doesn't, but I'm not well-versed in CLR internals enough to positively state it). ... I suppose you can think of String.Empty as the language-independent way of writing the empty string literal -- just in case your language designer forgot to supply a way to write one... ...
    (microsoft.public.dotnet.languages.csharp)
  • Any opinion about this?
    ... I'm just confused and against about assigning a empty string to the value ... of the name/value pair in TStrings, and it will delete the whole name/value ... Tiger ...
    (borland.public.delphi.non-technical)
  • Re: More fun with attributes
    ... wrapper at that time did virtually nothing in the quasi-standards fork). ... the specs. ... returning an empty string in lieu of null). ... there (e.g. "booleans" in virtually every browser published this ...
    (comp.lang.javascript)