PDA

View Full Version : Multiple onLoads



mackenzie
07 Jul 2009, 05:15 AM
Hi guys

Hopefully a quick question and answer, I am having trouble using multi onload events in my <Body>. I am using the Scroller to control a news reel that runs along the top and I also want to utilise a photo lightbox on the same page. I have had both working individually but can not get them working together.



<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>

<script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="js/jquery.li-scroller.1.0.js"></script>
<script type="text/javascript">
$(function(){
$("ul#news-scroller").liScroll({travelocity: 0.04});
});
</script>


<body onload="clickMenu('gallery'); initLightbox();">


If anyone could point me in the right direction that would be awesome.

Thanks in advance.

Mackenzie.

Alan
08 Jul 2009, 12:42 AM
I'd never claim to be a JS pro but what about creating a function to manage onload functions?

So when the script is called, onLoad="myloadingfunc();"


function myloadingfunc() {
clickmenu('gallery);
initLightbox();
}