[thelist] How to Show/Hide if an option is selected in a pull-down

Jono ox4dboy at comcast.net
Tue Aug 24 09:02:09 CDT 2004


On 8/23/04 5:51 PM, "Peter Brunone (EasyListBox.com)"
<peter at easylistbox.com> wrote:

> If the value of the option is the ID of the tr, then it's really
> easy...
> 
> <select name="select3"
> onChange="showHide(this.options[selectedIndex].value);"
> 
> If you just want to turn on a specific element if *anything* is
> selected, you can say
> 
> <select name="select3" onChange="showHide(this.selectedIndex,
> 'whatever');">
> 
> And then the function itself will look like this:
> 
> function showHide (selIndex, id)
> { 
> var style = document.getElementById(id).style
> if (selIndex > 0)
> style.visibility = "visible";
> else  
> style.visibility = "hidden";
> }
> 
> 
> Cheers,
> 
> Peter Brunone

Thanks Peter!  Sorry, I forgot to specify - I need this functionality to
work in IE 5.0+, NS 4.7 (if possible) but definitely NS 6 & 7.  I will test
what you have suggested and see how it goes.  The JS example I posted in my
previous email worked in IE 5 - 6, and NS 6 & 7, but no 4.7.  NS 4.7 is not
a huge issue in this case, BUT it would be nice to be able to support it.



More information about the thelist mailing list