Results 1 to 3 of 3

Thread: body onload

  1. #1
    Join Date
    Apr 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question body onload

    Hi, i have 1 javascript code and a nav menu (mouseover image change) which both need to work on < body onload >But I dont know how to code them in order for this to happen
    Below is the code for the things i need to it for:

    ~~~~~~~~ Javascript ~~~~~~~~

    <script type="text/javascript" src="niftycube.js"></script>
    <script type="text/javascript">
    window.onload=function(){
    Nifty("div#mainbox","big");
    Nifty("div#slidebox");
    Nifty("div#txt","bottom,small");
    Nifty("div#linksbox");
    Nifty("div#facebook","top,small");
    Nifty("div#buttons");
    Nifty("div#welcome");
    Nifty("div#welcomehead","top,small");
    Nifty("div#welcomemain","bottom,small");
    }



    ~~~~~~~~ Nav Menu ~~~~~~~~
    <table width="55%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('homenav','','images/layout/menu/home-off.png',0)"><img src="images/layout/menu/home-on.png" name="homenav" width="136" height="77" border="0" id="homenav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('eventsnav','','images/layout/menu/events-on.png',0)"><img src="images/layout/menu/events-off.png" name="eventsnav" width="121" height="77" border="0" id="eventsnav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('djnav','','images/layout/menu/dj-on.png',0)"><img src="images/layout/menu/dj-off.png" name="djnav" width="121" height="77" border="0" id="djnav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('gallerynav','','images/layout/menu/gallery-on.png',0)"><img src="images/layout/menu/gallery-off.png" name="gallerynav" width="121" height="77" border="0" id="gallerynav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('hirenav','','images/layout/menu/hire-on.png',0)"><img src="images/layout/menu/hire-off.png" name="hirenav" width="121" height="77" border="0" id="hirenav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('locationnav','','images/layout/menu/location-on.png',1)"><img src="images/layout/menu/location-off.png" name="locationnav" width="121" height="77" border="0" id="locationnav" /></a></td>
    <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contactnav','','images/layout/menu/contact-on.png',0)"><img src="images/layout/menu/contact-off.png" name="contactnav" width="136" height="77" border="0" id="contactnav" /></a>
    </td></tr></table>


    Thank you in advance for your help

  2. #2
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <script type="text/javascript">
    function runMe(){
    Nifty("div#mainbox","big");
    Nifty("div#slidebox");
    Nifty("div#txt","bottom,small");
    Nifty("div#linksbox");
    Nifty("div#facebook","top,small");
    Nifty("div#buttons");
    Nifty("div#welcome");
    Nifty("div#welcomehead","top,small");
    Nifty("div#welcomemain","bottom,small");
    }
    </script>
    
    <body onload="runMe()">
    http://www.w3schools.com/jsref/event_body_onload.asp

  3. #3
    Join Date
    Dec 2009
    Posts
    54
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Thanks, ill ltry it later and then post on here

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
  •