PDA

View Full Version : body onload



moose1986
04-20-2011, 07:11 PM
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 :D

ricmetal
04-22-2011, 03:18 AM
<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

moose86
04-24-2011, 05:39 PM
Thanks, ill ltry it later and then post on here