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!

Invisility Cheats.

Status
Not open for further replies.

Deltaflyer

Programmer
Oct 11, 2000
184
GB
Does anybody know how to use JS to make a page element vanish?

I have the following

o Radio Button 1
o Radio Button 2
o Radio Button 2.1
o Radio Button 2.2

o Radio Button 3


and would like a way to hide the red selection until Radio Button 2 is selected. In IE this is easily done with
<script>
document.myname.radiobutton21.style.visibility='hidden'
document.myname.radiobutton22.style.visibility='hidden'
</script>

at the bottom of the page and when the radio button is clicked call function radbutshow()
<script>
function radbutshow()
{
document.myname.radiobutton21.style.visibility='visible'
document.myname.radiobutton22.style.visibility='visible'
}
</script>

however this does not work in netscape, please help me?????? DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
it should work in Netscape 6. in netscape 4.x you can only toggle visibility of layers. that is achieved like so:

document.layers.layername.visibility='hide'

However, I do not suggest supporting NS4.X anymore. A small percentage (<10%) are using this browser. If we (developers / designers) continue to support this, our clients / bosses will forever expect NS4 support. This forces our code to be clunky and inefficent. It also prevents us from using the latest/emerging technology (like DOM methods!). forget NS4. I only offer support for IE5+/NS6+ and some opera 5. jared@aauser.com
 
That's comforting, I am curious too, one would expect that code written for NN4 would work for 6 - is this not true? I have heard murmurs that it may not be? Groan - what next... BB &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
The murmurs are correct. Netscape 6 has achieved very strong standards compliance and no longer supports things like the layer tag or layer collection. Another headache? Not in my oponion! IE 5.5 also has reasonably strong standards support. This is a beautiful thing, because now I can write code for IE and Netscape without any browser detection or cross-browser fixes. Example at:


to hide an element in IE5+ use:

document.getElementById(&quot;sId&quot;).style.visibility='hidden'

to hide an element in NS6+ use:

document.getElementById(&quot;sId&quot;).style.visibility='hidden' jared@aauser.com
 
so document all doesn't work either? It is nice to see NN has style property now though. So are there no differences to worry about at all - with regard to styles? &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
Unfortunately jared, the pages that i am trying to develop are for an intranet.

This duly means that i have to use whatever software is available out there in the field. With over 5000+ users about to use the page (on NN4.51) i have to make all the functionality available to all systems.

I know that at the end of the year all users will have NN6.x, however in the meantime, can you help me?
DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top