Results 1 to 5 of 5

Thread: Switch Menu

  1. #1
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Menu

    1) Script Title: switch menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...switchmenu.htm

    3) Describe problem: Here is my site, I am prepping it for a release at the end of the weekend! First off, I know its a mess without CSS implimented and CSS tables would peobably be better and more efficient, but I just don't know how to do that all effectively right now and am trying to learn the pluses and minuses of using css over tables etc.

    I have 2 problems, I've searched on the forum to see if anyone has had the same issues as me and some have but not been replied to yet. Essentially I have two requests/issues.

    1) Using this script, when I have a menu item heading once clicked I would like it to expand to the sub menu but ALSO go to a URL pointed at an Iframe.. so it would function like:

    Menu title ---> http://....
    --->sub 1 ---> http://...
    --->sub 2 ---> http://...

    2) second issue is I have an image dividing my menu, because ou cannot seem to have two menus on one page, so I made it look like there are 3 menues divided by an image http://canadatrack.com/TorontoTrack

    This seems to work in IE 7.0 BUT doesnt work in FF! Why would this be?

    Finally, if anyone can help me clean up my page a little with tips on CSS and placing some of my page in an external file that would be more than appreciated.. please get back to me ASAP I will be checking this thread too often!

    Sincerely,
    Darwaing

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

    Default

    Regarding #1, if I understood you correctly, you can always just attach a function to the header onClick code to do what you wish. Using the code from the demo for example:

    Code:
    <div class="menutitle" onclick="SwitchMenu('sub1'); dothat('http://google.com')">Site Menu</div>
    Where dothat() would be your custom function, in this case loading an IFRAME with a specific URL:

    Code:
    function dothat(url){
    document.getElementById('myiframe').src=url
    }
    Regarding #2, right now there's no easy way to have multiple Switch Menus on the same page. You can have a single menu with many menu headers and sub contents, but these react dependently, with one closing when the other opens. Accordion Menu supports multiple instances.

    BTW, please note that your page is currently in violation of our usage terms, since the credit notice doesn't appear inline on the page. Please reinstate the credit notice: http://www.dynamicdrive.com/notice.htm

  3. #3
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes I will place that information in the files as soon as I get it CSS compliant, I was just trying to clean the HTML up a little to try and sort things out. I will definately place the header back in there.

    okay I think I understand what you are trying to say, unsure how to implient it but I will do my best.

    Secondly, its made as one menu however there is an image in that menu which is messing things up in FF... Do you see any other way of adding that image in there (to look like a seperate box) without changing scripte?

    Thanks for your help it is greatly appreciated, I will be working on the CSS and placing that info back into my page immediately

  4. #4
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I've got the function working in IE but not working n FF..

    Code:
    function menutitle(url){
    document.getElementById('I1').src=url
    }
    Code:
    <div class="menutitle" onclick="SwitchMenu('sub4'); menutitle'http://youtube.com')">Cool links</div>
    what is IE reading that FF isnt?

    also my origional script wasnt from DD thats why it didnt have the tags, it was from http://javascript.internet.com/navig...ding-menu.html

  5. #5
    Join Date
    Dec 2007
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    For one thing, you'll want to make sure your menutitle function is called correctly. Currently you have:

    Code:
    menutitle'http://youtube.com')
    Where it should be:

    Code:
    menutitle('http://youtube.com')
    You're missing the opening parenthesis.

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
  •