Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: body onload interfearing

  1. #1
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default body onload interfearing

    1) Script Title: chained select menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/chainedmenu/

    3) Describe problem: The chained menu and the tabber.js (see attached) seem not to work together, caused by the body onload function. How can that be avoided, please ?

    onload function:

    Code:
    <body onload="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate')">

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Get rid of highlighted:

    Code:
    <body onload="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate')">
    Make a script as the last thing in your head section:

    Code:
    <script type="text/javascript">
    (function(){
    	function loader(){
    		initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate');
    	}
    	if (window.addEventListener)
    		window.addEventListener('load', loader, false);
    	else if (window.attachEvent)
    		window.attachEvent('onload', loader);
    })();
    </script>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    chechu (11-24-2009)

  4. #3
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Works amazingly well ! Thanks !

    I still have one issue with the script: I can't seem to open the links in the same page, allthough I placed everything into 0

    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="goto" //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/////////////////
    
    addListGroup("chainedmenu", "First-Select");
    
    
    addOption("First-Select", "zoek een kunstenaar", "", 0);
    addList("First-Select", "alfabetisch", "", "alfa");
    addList("First-Select", "volgens regio", "", "regio");
    
    	addOption("alfa", "maak je keuze", "", 0); 
    	addList("alfa", "C", "", "C");
    	addList("alfa", "S", "", "S");
    
    		addOption("C", "maak je keuze", "", 0);
    		addOption("C", "Ceci Casariego", "casariego.php");
    
    		addOption("S", "maak je keuze", "", 0);
    		addOption("S", "Luc Standaert", "standaert.php");
    
    	addOption("regio", "maak je keuze", "", 0);
    	addList("regio", "Antwerpen", "", "Apen");
    	addList("regio", "West-Vlaanderen", "", "X");
    	addList("regio", "Oost-Vlaanderen", "", "Oost");
    	addList("regio", "Limburg", "", "X");
    	addList("regio", "Vlaams-Brabant", "", "X");
    
    		addOption("Apen", "maak je keuze", "", 0);
    		addOption("Apen", "Ceci Casariego", "casariego.php");
    
    		addOption("Oost", "maak je keuze", "", 0);
    		addOption("Oost", "Luc Standaert", "standaert.php");

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Might be a bug in the script, but more likely something about your page. Let's check your page first:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #5
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    http://www.portretkunst.be
    (please note that now I have placed all back into 1 instead of 0)

    You will see that I cannot place the code on the "kalender" page, because also there is an interfearance with the body onload.

  7. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I made a local copy of the page, put in place of:

    Code:
    <script language="javascript" src="images/css/config.js"></script>
    this:

    Code:
    <script language="javascript">
    //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="goto" //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/////////////////
    
    addListGroup("chainedmenu", "First-Select");
    
    
    addOption("First-Select", "zoek een kunstenaar", "", 1);
    addList("First-Select", "alfabetisch", "", "alfa");
    addList("First-Select", "volgens regio", "", "regio");
    
    	addOption("alfa", "maak je keuze", "", 1); 
    	addList("alfa", "C", "", "C");
    	addList("alfa", "S", "", "S");
    
    		addOption("C", "maak je keuze", "", 1);
    		addOption("C", "Ceci Casariego", "http://www.portretkunst.be/casariego.php");
    
    		addOption("S", "maak je keuze", "", 1);
    		addOption("S", "Luc Standaert", "http://www.portretkunst.be/standaert.php");
    
    	addOption("regio", "maak je keuze", "", 1);
    	addList("regio", "Antwerpen", "", "Apen");
    	addList("regio", "Oost-Vlaanderen", "", "Oost");
    
    		addOption("Apen", "maak je keuze", "", 1);
    		addOption("Apen", "Ceci Casariego", "http://www.portretkunst.be/casariego.php");
    
    		addOption("Oost", "maak je keuze", "", 1);
    		addOption("Oost", "Luc Standaert", "http://www.portretkunst.be/standaert.php");
    
    
    
    
    </script>
    And it worked. So you should be able to just make that one change in the config.js file. If it doesn't work right away, be sure to clear the browser's cache and refresh the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #7
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    I copied your piece of code, but doesn't work ?
    I replaced this line in the head
    Code:
    <script language="javascript" src="images/css/config.js"></script>
    for your code above. Correct ?

    I am using now this url as example to play with: http://www.portretkunst.be/aa.php

  9. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Where you have:

    Code:
    <input type="submit" value="&#187 bekijk je keuze" style="margin-top:5px; text-align:left; border:0px;" onclick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
    It needs yo be:

    Code:
    <input type="button" value="&#187 bekijk je keuze" style="margin-top:5px; text-align:left; border:0px;" onclick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
    There may still be other problems.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. The Following User Says Thank You to jscheuer1 For This Useful Post:

    chechu (11-24-2009)

  11. #9
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Works perfectly now.
    Will change it in the whole site. Thanks !

    Only issue now is how to mix it with the calendar here: http://www.portretkunst.be/kalender.php

    There is an onload function that stops the chained menu from functioning:
    Code:
    <body onload="changedate('return')">
    Here is the page, with your adapted code added:http://www.portretkunst.be/aa.php
    Last edited by chechu; 11-24-2009 at 08:37 PM.

  12. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Seems OK here, perhaps you need to refresh the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •