Results 1 to 4 of 4

Thread: Combo Box viewer: forgetting after reloading!

  1. #1
    Join Date
    Jul 2005
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Combo Box viewer: forgetting after reloading!

    Script: Combo Box viewer

    http://www.dynamicdrive.com/dynamici...omboviewer.htm

    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/dynamici...geselector.htm) that is on the same page!)

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

    http://www.bio.georgiasouthern.edu/G...ts/grlist.html


    Thanks in advance for any suggestions.

    Alan
    Last edited by aharvey; 09-23-2005 at 03:32 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The method that pops to mind is to give each dropmsg# division a name that would be the parameter to add to the url:
    Code:
    <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):
    Code:
    function expandone(){
    if (document.getElementById){
    var selectedItem=document.dropmsgform.dropmsgoption.selectedIndex
    var param=document.getElementById("dropmsg"+selectedItem).name
    contractall()
    document.getElementById("dropmsg"+selectedItem).style.display="block"
    window.location.replace('grlist.html?spp='+param+'&filaindex='+selectedItem)
    }
    }
    Using my example for dropmsg0, this would resolve the new location to:

    grlist.html?spp=Annelida&filaindex=0

    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:
    Code:
    href="grlist.html?spp=Bispiravariegata&amp;filaindex=0"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    XHTML is extremely case sensitive and unless there is a requirement for capital letters, all style and script code must be lower case.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •