Results 1 to 4 of 4

Thread: Help with target URL

  1. #1
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with target URL

    1) Script Title:
    Chained Select Menu
    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...ainedmenu.html
    Chained Select Menu
    3) Describe problem:

    I have the chained menu working here:

    http://staging.thecampushub.com/rede...rweb/o_ink.asp

    but I would like to the prices to appear in the iframe I have made (myiframe) not in a pop-up window. I have followed the advice here : http://www.dynamicdrive.com/forums/s...enu-URL-target

    But its still appearing as a popup. Any help woudl be appreciated!

    HTML Code:
    // Chained Menu
    
    // Copyright Xin Yang 2004
    // Web Site: www.yxScripts.com
    // EMail: m_yangxin@hotmail.com
    // Last Updated: 2004-08-23
    
    // This script is free as long as the copyright notice remains intact.
    
    var _disable_empty_list=false;
    var _hide_empty_list=false;
    
    // ------
    
    ///// 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
    document.getElementById("myiframe").src=selectedOptionvalue
    break
    }
    }
    }
    }
    ///// END DynamicDrive.com added function//////
    HTML Code:
    <body onLoad="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate')">
    <p>Ink ReFill Lookup </p>
    <p>&nbsp;</p>
    <form name="listmenu0">
    <table width="702" align="center"><tr>
    <td width="212"><select name="firstlevel" style="width:180px;"></select></td>
    <td width="189"><select name="secondlevel" style="width:160px;"></select></td>
    <td width="161"><select name="thirdlevel" style="width:160px;"></select></td>
    
    <td width="120"><input type="button" value="Go" onClick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
     <input type="button" value="Reset" onClick="resetListGroup('chainedmenu')">
    </tr></table>
    <iframe id="myiframe" src="../ink.html"></iframe>
    </form>
    HTML Code:
    //var hide_empty_list=true; //uncomment this line to hide empty selection lists
    var disable_empty_list=true; //uncomment this line to disable empty selection lists
    
    var onclickaction="alert" //set to "alert" or "goto". Former is for debugging purposes, to tell you the value of the final selected list that will be used as the destination URL. Set to "goto" when below configuration is all set up as desired. 
    
    var newwindow=0 //Open links in new window or not? 1=yes, 0=no.
    
    /////DEFINE YOUR MENU LISTS and ITEMS below/////////////////

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    in the config

    Code:
    var newwindow='myiframe' //Open links in new window or not? 1=yes, 0=no, string = iframe.
    modified function

    Code:
    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 (document.getElementById(newwindow)){
     document.getElementById(newwindow).src=selectedOptionvalue;
    }
    else if (newwindow==1)
    window.open(selectedOptionvalue)
    else
    window.location=selectedOptionvalue
    break
    }
    }
    }
    }
    html

    Code:
    <form name="listmenu0">
    <table align="center"><tr>
    <td><select name="firstlevel" style="width:180px;"></select></td>
    <td><select name="secondlevel" style="width:160px;"></select></td>
    <td><select name="thirdlevel" style="width:160px;"></select></td>
    <td><input type="button" value="Go" onclick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
     <input type="button" value="Reset" onclick="resetListGroup('chainedmenu')">
    </tr></table>
    </form>
    <iframe id="myiframe" ></iframe>
    
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks! I'll give it a try today!

  4. #4
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was able to try that code and it works if the end of the menu is a URL, which makes sense as that's how the sample is setup.

    Is there any way this code could display text instead of a URL? Such as in sample.html, instead of going to cnet.com the iframe just displays the text "cnet.com"?

    Thanks for your help!

Similar Threads

  1. Target DIV?
    By TheJoshMan in forum HTML
    Replies: 6
    Last Post: 02-29-2016, 12:22 PM
  2. How to target IE only
    By cryoffalcon in forum CSS
    Replies: 4
    Last Post: 05-09-2012, 07:46 PM
  3. target url
    By maskull in forum JavaScript
    Replies: 4
    Last Post: 09-27-2009, 03:08 AM
  4. Target a page and load target iframe
    By deneb87 in forum HTML
    Replies: 3
    Last Post: 05-26-2007, 08:37 AM
  5. target in javascript
    By toe_head2001 in forum JavaScript
    Replies: 8
    Last Post: 01-09-2006, 08:33 PM

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
  •