View Full Version : Combo Box viewer: forgetting after reloading!

09-23-2005, 03:22 PM
Script: Combo Box viewer


Problem: Choosing a selection from the Combo Box brings down a list of species names, which are links to information, pix, etc. about that species. Species are grouped by phyla, which are the combo box categories. Changing categories using the combo box gives you a different list, but doesn't by itself change the species shown. I've been staring at this for a while, but can't figure out how to have the combo box routine not just change the list of links displayed, but also choose as a default the first species in the new list to display (in effect having the combo box routine "talk to" the dynamic image selector routine (http://www.dynamicdrive.com/dynamicindex4/imageselector.htm) that is on the same page!)

In case this isn't clear, here's my working document:


Thanks in advance for any suggestions.


09-24-2005, 04:56 AM
The method that pops to mind is to give each dropmsg# division a name that would be the parameter to add to the url:

<div id="dropmsg0" name="Annelida" class="dropcontent">Annelida would be the parameter we will want to pass. We can do this in the expandone() function, like so (additions red):

function expandone(){
if (document.getElementById){
var selectedItem=document.dropmsgform.dropmsgoption.selectedIndex
var param=document.getElementById("dropmsg"+selectedItem).name
}Using my example for dropmsg0, this would resolve the new location to:


So, you would need something to load over there on the right that would be triggered by this being the new location of the page, similar to the way you have these type of links:


09-26-2005, 08:39 PM
John, thanks, I'll pore over your suggestions. Meanwhile, I decided to use this page to enter the modern world of (x)html coding, starting safely by using a simple external style sheet (no problem) and then making it an XHTML transitional document. Doing that had just one unexpected effect: the browser now ignored the set width of the first combo box(180 pixels) and as far as I can tell set it to the width of the widest choice. When I returned to good old <html>, it properly set the box width as before. Unexpected, to me at least!

09-26-2005, 10:17 PM
XHTML is extremely case sensitive and unless there is a requirement for capital letters, all style and script code must be lower case.