Results 1 to 3 of 3

Thread: Chained Select Menu URL target

  1. #1
    Join Date
    Oct 2004
    Location
    Texas
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Chained Select Menu URL target

    Chained Select Menu - DD/Xin Yang script - Dealing with the DD added section
    http://www.dynamicdrive.com/dynamici...menu/index.htm
    Unfortunately, I don't have a working page of this since, well, I can't get it to work the way I want it to.

    I seem to be having a bit of a problem getting the script to direct the "end selection" to an iframe located in the page the drop downs are on. The part of the config.js script that allows for new or same window target is set to the same window.

    -- config.js excerpt --
    var newwindow=0 //Open links in new window or not? 1=yes, 0=no.
    (default setting)

    I've tried several changes to the chainedmenu.js script dealing with the "end selection" area but so far, no luck at all.

    -- chainedmenu.js excerpt dealing with URL direction --

    ///// DynamicDrive.com added function/////////////

    var onclickaction="alert"

    function goListGroup(){
    for (i=arguments.length-1;i>=0; i--){
    if (arguments[i].selectedIndex!=-1){
    var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex].value
    if (selectedOptionvalue!=""){
    if (onclickaction=="alert")
    alert(selectedOptionvalue)
    else if (newwindow==1)
    window.open(selectedOptionvalue)
    else
    window.location=selectedOptionvalue
    break

    }
    }
    }
    }

    ///// END DynamicDrive.com added function//////

    The above excerpt is as is from the zip file located here at DD. I've changed it to "goto" where needed in the script(s) when I test my changes, but I'm not getting anywhere so I've reset it to the defaults.

    I'm thinking the part that needs modifying is in blue, but I could be wrong.

    I know this is just a case of overthinking the problem, but could someone please take a look at it and see what it is I need to change here? The Iframe I'm targeting is called "description".

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

    Default

    Ok, try changing:

    Code:
    window.location=selectedOptionvalue
    to:
    Code:
    document.getElementById("myiframe").src=selectedOptionvalue
    with "myframe" being the ID of the iframe in question, for example:
    Code:
    <iframe id="myiframe" src="...></iframe>

  3. #3
    Join Date
    Oct 2004
    Location
    Texas
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    As the guys on the "Guinness Stout" commercials say "BRILLIANT!"

    Thank you so very much.

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
  •