Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Browsers / Internet Explorer / September 2003



Tip: Looking for answers? Try searching our database.

onload() not in body

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Waldman - 23 Sep 2003 18:03 GMT
I am trying to call a function which initializes my DHTML menu (using <ul> and <li>) when the page loads.  

Since I am working within a portal environment, I cannot call the event from the body statement.

Is there anywhere else I can place this code so that it will initialize the menu when the page loads?

function initialiseMenu()
{
    var objLICollection = document.body.getElementsByTagName("LI");       
    for(var i = 0; i < objLICollection.length; i++)
    {       
        var objLI = objLICollection[i];                                       
        for(var j = 0; j  < objLI.childNodes.length; j++)
        {
            if(objLI.childNodes.item(j).nodeName == "UL")
            {
                objLI.onmouseover=showSubMenu;
                objLI.onmouseout=hideSubMenu;
               
                for(var j = 0; j  < objLI.childNodes.length; j++)
                {
                    if(objLI.childNodes.item(j).nodeName == "A")
                    {                   
                        objLI.childNodes.item(j).className = "hassubmenu";                               
                    }
                }
            }
        }
    }
}
Tim Ellison - 29 Sep 2003 17:41 GMT
You could script it out in the body of your html as follows:

<SCRIPT language="javascript" defer>
...
</SCRIPT>

"defer" will allow the page to load then the script will execute.

Signature

Regards,

Tim Ellison, MCP
Whitlock eBusiness Solutions
(w) 804-794-2871 x144
(m) 804-405-4874

> I am trying to call a function which initializes my DHTML menu (using <ul> and <li>) when the page loads.
>
[quoted text clipped - 26 lines]
> }
> }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.