<label for="ddlGradientMode" id="lblGradientMode"
name="lblGradientMode">GradientMode: </label>
<select name="ddlGradientMode" id="ddlGradientMode"></select>
<label for="txtTexture" id="lblTexture" name="lblTexture">Texture: </label>
<input name="txtTexture" type="text" id="txtTexture" style="width:400px;" />
I use the following JavaScript to attempt to hide them:
document.forms[0].lblGradientMode.style.display='none';
document.forms[0].ddlGradientMode.style.display='none';
document.forms[0].lblTexture.style.display='none';
document.forms[0].txtTexture.style.display='none';
However, this code does not seem to work for the label tags. Why is this,
and how can I fix it? Thanks. (NOTE: I am using IE6 on Windows XP Pro)
--
Nathan Sokalski
njsok...@hotmail.com
http://www.nathansokalski.com/
A guess might be that they are not members of the form since they can not hold user data.
D.
document.lblGradientMode.style.display='none';
but it still did not work. Any other ideas?
--
Nathan Sokalski
njsok...@hotmail.com
http://www.nathansokalski.com/
"dNagel" <NOTGra...@NotMail.com> wrote in message
news:44C56376...@NotMail.com...
lblGradientMode.style.display='none';
or
document.all.lblGradientMode.style.display='none';
or
document.forms[0].all.lblGradientMode.style.display='none';
or (cross-browser)
document.getElementById('lblGradientMode').style.display='none';
:
: "dNagel" <NOTGra...@NotMail.com> wrote in message
:
:
"Walter Zackery" <please_r...@group.com> wrote in message
news:O8wRbo4r...@TK2MSFTNGP03.phx.gbl...
This...
document.forms[0].lblGradientMode
...is shorthand notation for:
document.forms[0].elements["lblGradientMode"]
As such, the element must be of the appropriate type for the collection:
http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-76728479
In this case, that is a control. LABEL is not listed among the control types
in HTML:
http://www.w3.org/TR/html401/interact/forms.html#didx-control
This should not worry you, since you can use document.getElementById(). I
know you can use it because you use the ID attribute, which requires
uniqueness. Therefore, the following will suffice:
document.getElementById("lblGradientMode").style.display = "none"
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Do you have a style for label that defines the display, e.g. <style...>label
{ display:block; }</style>. I seem to remember having a problem using
JavaScript to override a style that was defined in a stylesheet or <style>
tag. Can't remember what the exact issue was.
Have you written some test JavaScript that just tries to access the label
and do something else besides change the style? Narrow down your issue.
Maybe you're just not getting a handle on the object.
Have you tried it on different browsers? Perhaps you are running into the
joys of browser incompatibilities/non-standardization.
Mike
"Nathan Sokalski" <njsok...@hotmail.com> wrote in message
news:u4H4W33r...@TK2MSFTNGP04.phx.gbl...