Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding text + form field

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
I'm hoping that this is going to be an easy question. I have a cell in a table that contains normal text and an input text field. What i want to be able to do is have these hidden and then display them when the OnChange event in another field is triggered. I know that I can used the STYLE="display:none" to hide the text field but how do I hide the normal text?? Mise Le Meas,

Mighty :)
 
you could use a <span> and then dynamically control the contents of that span through

spanID.innerHTML

replace it with  non-breaking spaces when you want to hide it???

 
link9,

Thanks for the suggestion but I an having problems. Do I use <SPAN NAME=&quot;mySpan&quot;> to identify the span.

I am then using document.myspan.innerHTML to try to modify it.

Is this completely wrong?? Mise Le Meas,

Mighty :)
 
yea -- that's right, but add an id to the span, as well.

If I'm not mistaken, I believe that is the way you have to refer to the span -- through its id

<SPAN NAME=&quot;mySpan&quot; id=&quot;mySpan&quot;>

Should work the trick. :)
 
I keep getting a JavaScript error saying that document.mySpan is not an object. What am I doing wrong??

In my Javascript function I have the following:

document.invForm.mySpan.innerHTML = &quot;<B>INVOICE NUMBER</B>&quot;;

In the body of my code I have the following:

<TD ALIGN=&quot;CENTER&quot; WIDTH=&quot;150&quot;><SPAN NAME=&quot;mySpan&quot; ID=&quot;mySpan&quot;>&nbsp;</SPAN></TD> Mise Le Meas,

Mighty :)
 
sorry, bud -- my bad --

not supposed to preface it with document or anything -- just do this:

mySpan.innerHTML = '<B>INVOICE NUMBER</B>';

:)
 
Ya know, though -- using layers might be a better solution to the problem --

put all the content that you wish to hide on a layer that has an initial visible property of hidden -- and then change it to visible when a certain event happens --

just an idea :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top