[thelist] How to Show/Hide if an option is selected in a pull-down
Peter Brunone (EasyListBox.com)
peter at easylistbox.com
Tue Aug 24 09:17:26 CDT 2004
Ah, that one! Well then, you'll need a little extra code for the invisible element (the form field code should still work just fine). I wrote an article a few years back that dealt with Hiding/Showing for NS4-7 and IE4-6... ignore the ASP stuff, but the javascript should be what you need.
http://aspalliance.com/peterbrunone/pleaseWait.asp
Cheers,
Peter
Original Message:
>From: Jono <ox4dboy at comcast.net>
>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.
>
>--
>
>News! - Evolt.org conference for web professionals.
>17-19 September 2004 in Toronto, Canada.
>Details at http://TOevolt.org
>
>* * Please support the community that supports you. * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !
>
>
More information about the thelist
mailing list