Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Akron, Ohio
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help needed with JavaScript Dropdown menu

    Ok, i just installed a JavaScript Dropdown menu into my site to replace my older navigation system on my site. I like to use frames for my site, but when i click a link on the menu, it pops up in a new page. How do i make the page open in the frame? Here is the site: www.gundamv3.com and here is the java script and the frame:

    <select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
    <option value="http://www.gundamv3.com/main.html">Home</option>
    <option value="http://www.gundamv3.com/about.html">About</option>
    <option value="http://www.gundamv3.com/support.html">Support</option>
    <option value="http://www.gundamv3.com/Series.html">Series</option>
    <option value="http://www.gundamv3.com/MM.html">Multimedia</option>
    <option value="http://www.gundamv3.com/models.html">Models</option>
    <option value="http://www.gundamv3.com/merc.html">Merchindise</option>
    <option value="http://www.gundamv3.com/links.html">Links</option>
    <option value="http://www.gundamv3.com/MISC.html">MISC</option>
    <option value="http://gundamv3.signmyguestbook.com">Guestbook</option>
    </select>
    </form>
    and here is the frame:

    <iframe name="main" width="795" height="629" src="main.html">
    Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></tr>
    <tr>

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I am using a Mac and Netscape 7. I have attached a screenshot. 1024 x 768 resolution. You have to reference your frame in yout link.

    MNS
    Attached Thumbnails Attached Thumbnails Help needed with JavaScript Dropdown menu-picture-1.jpg  

  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Akron, Ohio
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but where and what exaclly should the code be?

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    try adding target="main" to your links.

    <option value="http://www.gundamv3.com/about.html" target="main">About</option>

    It may need an undescore in there too. Try it and see what works. target="_main"

    MNS

  • #5
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Akron, Ohio
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    for some reason it works with this optiton:
    <option value="http://www.gundamv3.com/main.html">Home</option>
    but none of the others

  • #6
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I haven't tested it, but after looking at your 1.2.0 site, I think this should work. Let me know if it doesn't.

    Add this to your HEAD (or use an external .js file... whichever you prefer)
    Code:
    function changePage(changeTo)
    {
    	if (document.getElementById) document.getElementById('main').src=changeTo.options[changeTo.selectedIndex].value; //  For W3C DOM
    	else if (document.all) document.all.main.src=changeTo.options[changeTo.selectedIndex].value; // For older IE4 DOM
    }
    When you want to call the function from the SELECT box, do this:
    Code:
    <select name="menu" onchange="changePage(this);" value="GO">
    It should work. If worse comes to worse, you can edit it to use the full form reference instead of the shorter "this.options[]" reference.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #7
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Akron, Ohio
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    doesnt work, but thats probally from my craptacular JavaScript Skills. Here is the HTML of the javascript after i tried to edit it (now due to i am lost, could you please explain it to someone that only know HTML not javascipt ^_^i)

    Code:
    <select name="menu" onchange="changePage(this);" value="GO" src="menu.js">
    <option value="http://www.gundamv3.com/main.html">Home</option>
    <option value="http://www.gundamv3.com/about.html">About</option>
    <option value="http://www.gundamv3.com/support.html">Support</option>
    <option value="http://www.gundamv3.com/Series.html">Series</option>
    <option value="http://www.gundamv3.com/MM.html">Multimedia</option>
    <option value="http://www.gundamv3.com/models.html">Models</option>
    <option value="http://www.gundamv3.com/merc.html">Merchindise</option>
    <option value="http://www.gundamv3.com/links.html">Links</option>
    <option value="http://www.gundamv3.com/MISC.html">MISC</option>
    <option value="http://gundamv3.signmyguestbook.com">Guestbook</option>
    </select>
    </form>
    and before can be seen above

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">

    should be something like document.iframname.location=....

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <select name="menu" onChange="document.frames['menu'].location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
    <option value="http://www.gundamv3.com/main.html">Home</option>
    <option value="http://www.gundamv3.com/about.html">About</option>
    <option value="http://www.gundamv3.com/support.html">Support</option>
    <option value="http://www.gundamv3.com/Series.html">Series</option>
    <option value="http://www.gundamv3.com/MM.html">Multimedia</option>
    <option value="http://www.gundamv3.com/models.html">Models</option>
    <option value="http://www.gundamv3.com/merc.html">Merchindise</option>
    <option value="http://www.gundamv3.com/links.html">Links</option>
    <option value="http://www.gundamv3.com/MISC.html">MISC</option>
    <option value="http://gundamv3.signmyguestbook.com">Guestbook</option>
    </select>
    </form>
    try that for the select box.
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)

  • #10
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Akron, Ohio
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks readme.txt your idea worked ^_^ just had to replace teh ['menu'] part with ['main'] (main is the frames name)


  •  

    Posting Permissions

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