[WEB4LIB] hiding and displaying an option element using JavaScript

Justin Rounds jrounds at uchicago.edu
Fri Apr 15 17:36:04 EDT 2005


What you're trying to do should work -- what browser and os is this 
*not* working on?
_
j


John Fitzgibbon wrote:
> Hi,
> 
> Hi,
> 
> I need to hide a number of option elements in one drop down list based
> on the user selecting an option in another drop down list.
> 
> The Javascript code I'm using is
> 
> document.getElementById('starts4').style.display='none';
> 
> where 'starts4' is the id of the option element I'm trying to hide. I
> tried using a span element within the option element and giving it an id
> of 'starts4' but to no avail.
> 
> If the element is not an option element, everything works fine. The
> element appears and reappears as required.
> 
> Using 
> 
> document.frmNameSearch.elements[4].options[1]=null
> 
> is too messy, in this case, because it changes the index numbers of the
> option elements within the options array. Several options have to vanish
> and reappear depending on what is clicked and the changing of the index
> numbers makes it difficult to keep track of everything.
> 
> If the first approach could be made to work it would save a great deal
> of typing.
> 
> Any ideas would be very welcome. 
> 
> John Fitzgibbon
> 
> Galway Public Library
> Island House
> Cathedral Square
> Galway
> Ireland
> 
> p: 00 353 91 562471
> f: 00 353 91 565039
> w: http://www.galwaylibrary.ie 
> 
> ******************************************************************* 
> T� eolas at� pr�obh�ideach agus r�nda sa r�omhphost seo 
> agus aon iat�n a ghabhann leis agus is leis an duine/na daoine
> sin amh�in a bhfuil siad seolta chucu a bhaineann siad. 
> Mura seola� th�, n�l t� �daraithe an r�omhphost n� aon iat�n 
> a ghabhann leis a l�amh, a ch�ip�il n� a �s�id. 
> M� t� an r�omhphost seo faighte agat tr� dhearmad, 
> cuir an seolt�ir ar an eolas thr� aischur r�omhphoist 
> agus scrios ansin � le do thoil. 
> 
> This e-mail and any attachment contains information which is 
> private and confidential and is intended for the addressee 
> only. If you are not an addressee, you are not authorised 
> to read, copy or use the e-mail or any attachment. 
> If you have received this e-mail in error, please notify 
> the sender by return e-mail and then destroy it. 
> *********************************************************************
> 
> 
> 

-- 
-------------------------------------------
Justin Rounds
Graphic Design and Digital Media Specialist
Digital Library Development Center
University of Chicago
1100 East 57th Street
Chicago, Illinois 60637
(773)702-4391
-------------------------------------------



More information about the Web4lib mailing list