Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: body onload

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

    Default body onload

    There are two body onloads needed on my page. How can I mix them ?
    Here they are:
    Code:
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="document.getElementById('loading').style.display = 'none';document.getElementById('content').style.display = 'inline';">
    
    <div id="loading">
    <img src="images/header.jpg" style="border: 0px; text-align:center; margin-top:1px;">
    <p align=center><b>TITLE</b>
    <p align=center>subtitle
    <p align=center><br>&nbsp;<br><img src="images/loader.gif" style="border: 0px;">
    </div>
    <div id='content' style='display:none;'>
    and
    Code:
    onload="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, document.listmenu0.fourthlevel, 'saveit')"

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    This should do it:
    Code:
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="document.getElementById('loading').style.display = 'none';document.getElementById('content').style.display = 'inline';initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, document.listmenu0.fourthlevel, 'saveit');">
    
    <div id="loading">
    <img src="images/header.jpg" style="border: 0px; text-align:center; margin-top:1px;">
    <p align=center><b>TITLE</b>
    <p align=center>subtitle
    <p align=center><br>&nbsp;<br><img src="images/loader.gif" style="border: 0px;">
    </div>
    <div id='content' style='display:none;'>
    Jeremy | jfein.net

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

    Default

    No, doesn't work. The first one comes up (with the divs), the other doesn't.
    The second one is the dropdown select (four).
    You can see it here

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Change that "inline" to block. Then set the float to left (use clear:both on a following element).
    - Mike

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try:
    Code:
    <script type="text/javascript">
    var onLoadfunc = function(){
    document.getElementById('loading').style.display = 'none';
    document.getElementById('content').style.display = 'inline';
    initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, document.listmenu0.fourthlevel, 'saveit');
    }
    </script>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadfunc();">
    
    <div id="loading">
    <img src="images/header.jpg" style="border: 0px; text-align:center; margin-top:1px;">
    <p align=center><b>TITLE</b>
    <p align=center>subtitle
    <p align=center><br>&nbsp;<br><img src="images/loader.gif" style="border: 0px;">
    </div>
    <div id='content' style='display:none;'>
    Jeremy | jfein.net

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

    Default

    Nile, yours still doesn't work.
    Mburt, I do not understand you very well.

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Using Nile's script...
    Code:
    <script type="text/javascript">
    var onLoadfunc = function(){
    document.getElementById('loading').style.display = 'none';
    document.getElementById('content').style.display = 'block';
    document.getElementById('content').style.float = 'left';
    initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, document.listmenu0.fourthlevel, 'saveit');
    }
    </script>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadfunc();">
    
    <div id="loading">
    <img src="images/header.jpg" style="border: 0px; text-align:center; margin-top:1px;">
    <p align=center><b>TITLE</b>
    <p align=center>subtitle
    <p align=center><br>&nbsp;<br><img src="images/loader.gif" style="border: 0px;">
    </div>
    <div id='content' style='display:none;'>
    Now this is only assuming... I haven't looked deeply into the matter.
    - Mike

  8. #8
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,625
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You can have a new onload event of window object which triggers both the operations you've mentioned in your code. Insert the following code in your script element and remove the "onload" event from the body element, both ones should be removed. If you have multiple onload events on "window" object only one will be executed. So if you have more than one scripts that needs to be executed as a part of the onload event of "window", we used to club them together the way I've done below:

    Code:
    window.onload = function(){
    	document.getElementById('loading').style.display = 'none';
    	document.getElementById('content').style.display = 'inline';
    	
    	initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, document.listmenu0.fourthlevel, 'saveit')
    }
    Before doing so make sure that the 'initListGroup' function call is meaningful and work with the mentioned parameters.

    It would be better if you post a link of your page so that everyone can have a look at it.

    Hope this helps.
    Last edited by codeexploiter; 09-01-2008 at 05:50 AM. Reason: Code edited after Nile's warning. Typos

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I actually think it has to do with the inline style property. It doesn't always work cross-browser.
    - Mike

  10. #10
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,625
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Mike, Actually it works but the fourth select list will be enabled only a number of occassions.

    If you load the following values in the respective select list then the fourth select list will be enabled

    select1 -> Vakantiepark
    select2 -> CenterParcs
    Select3 -> Belgie or Select3 -> Nederland

    But I don't think the script's function is correct seems to be somewhat inconsistent though...

    Chechu plz post a link to the menu script you use.

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
  •