Results 1 to 3 of 3

Thread: Drop-Down Document Viewer

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

    Default Drop-Down Document Viewer

    DD Script: Drop-Down Document Viewer
    http://www.dynamicdrive.com/dynamici...opdownview.htm

    I hope this doesn't qualify as trying to get several of the same script on one page. I want to modify a part of it to allow for seperate menus.

    Right now the script only recognizes the form name "jumpy" and the select name "example".

    Suppose I wanted the same Iframe to additionally respond to a "jumpy2" and "example2", or several "jumpy" and "example"s??

    Seperately, instead of the > symbols, the example code has many of those replaced with: > so for beginners who know less than even me, they may run into problems if they copy and paste it.

    I sincerely appreciate any help.
    Last edited by alfredglenstein; 11-30-2005 at 09:34 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    That actually just requires a simple modification. First, replace function gone() inside the script with the modified version instead:

    Code:
     
    function gone(selectobj){
    var selectedurl=selectobj.options[selectobj.selectedIndex].value
    if (document.getElementById&&displaymode==0)
    document.getElementById("external").src=selectedurl
    else if (document.all&&displaymode==0)
    document.all.external.src=selectedurl
    else{
    if (!window.win2||win2.closed)
    win2=window.open(selectedurl)
    //else if win2 already exists
    else{
    win2.location=selectedurl
    win2.focus()
    }
    }
    }
    Then for your drop down menus, use this syntax instead:

    Code:
     
    <form>
    <select name="menu1" size="1" onChange="gone(this)">
    <!-- CHANGE THE BELOW URLS TO YOUR OWN-->
    <option value="http://www.yahoo.com" selected>Yahoo.com</option>
    <option value="http://www.google.com">Google</option>
    <option value="http://www.lycos.com">Lycos</option>
    <option value="http://www.AltaVista.com">AltaVista</option>
    </select>
    <input type="button" name="test" value="Go!" onClick="gone(this.form.menu1)">
     
    <select name="menu2" size="1" onChange="gone(this)">
    <!-- CHANGE THE BELOW URLS TO YOUR OWN-->
    <option value="http://www.cnn.com" selected>CNN.com</option>
    <option value="http://news.bbc.co.uk">BBC News</option>
    <option value="http://www.msnbc.com">MSNBC</option>
    </select>
    <input type="button" name="test" value="Go!" onClick="gone(this.form.menu2)">
    </form>
    This creates two menus, though can have as menus as you want.

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

    Default

    thanks!

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
  •