Results 1 to 4 of 4

Thread: Drop down menu w/ description

  1. #1
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Drop down menu w/ description

    I have a web consisting of frames. Using a drop-down menu in one frame, I want to be able to open a page in another frame. How do I modify the code so that the page opens in the desired frame rather than the same frame?

    Thanks in advance.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Dec 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Drop down menu w/ description

    I have a web consisting of frames. Using a drop-down menu in one frame, I want to be able to open a page in another frame. How do I modify the code so that the page opens in the desired frame rather than the same frame?


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

    <form name="form1">
    <select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
    <option selected value="http://www.javascriptkit.com">JavaScript Kit </option>
    <option value="http://freewarejava.com">Freewarejava.com</option>
    <option value="http://wired.com" target="newwin">Wired News</option>
    <option value="http://www.news.com">News.com</option>
    <option value="http://www.codingforums.com" target="newwin">Coding Forums</option>
    </select>
    <input type="button" value="Go"
    onClick="jumptolink(document.form1.select1)"><br>
    <span id="textcontainer1" align="left" style="font:italic 13px Arial">
    </span>
    </form>

    <!--IMPORTANT: Below script should always follow all of your HTML codes above, and never proceed them-->
    <!--To be safe, just add below script at the end of your page-->

    <script type="text/javascript">


    var thetext1=new Array()
    thetext1[0]="Comprehensive JavaScript tutorials and over 400+ free scripts"
    thetext1[1]="Direct link to hundreds of free Java applets online!"
    thetext1[2]="Up to date news on the technology front"
    thetext1[3]="News.com- The #1 technology News site."
    thetext1[4]="Web Coding and development forums"


    var thetext2=new Array()
    thetext2[0]="CNN- US and World News."
    thetext2[1]="MSNBC- NBC News online."
    thetext2[2]="BBC News- Updated every minute of every day."
    thetext2[3]="TheRegister- Daily IT news."

    function displaydesc(which, descriptionarray, container){
    if (document.getElementById)
    document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]
    }

    function jumptolink(what){
    var selectedopt=what.options[what.selectedIndex]
    if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
    window.open(selectedopt.value)
    else
    window.location=selectedopt.value
    }

    displaydesc(document.form1.select1, thetext1, 'textcontainer1')
    displaydesc(document.form2.select2, thetext2, 'textcontainer2')

    </script>

    Thanks in advance.

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

    Default

    Firstly, please make sure the copyright is present in your actual page using the script, which reads:

    /***********************************************
    * Drop down menu w/ description- © Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    I don't see that in the posted code above. Our usage terms here: http://www.dynamicdrive.com/notice.htm

    Regarding your question, try changing:

    window.location=selectedopt.value

    to:

    parent.myframe.location=selectedopt.value

    where "myframe" is the name of the frame you wish to target.

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
  •