Reputation: 397
I've got a script that uses <body onload="SlideShow()">
, but I don't want to call the script inside body tag. I also only want to call the script when needed. What is another method of calling the script where I can call the script where its going to be used.
So, lets say half way down the page I want to use the slideshow, I call it there.
Also, what if I have a slideshow in multiple places on the same page. Will calling it multiple times hurt anything or is there a method to prevent the script from being called more than once while still allowing the slideshow to continue. All settings are set inside the script, so all slideshows will run the same.
Upvotes: 0
Views: 58
Reputation: 7152
You want to call it half way down the page, then you can just write this,
<script type="text/javascript">
slideShow();
</script>
But I wouldn;t suggest writing in-line js.
Also, If you have an event on which you want to call the slideshow function, then just attach the function to that event.
Edit: If you have multiple slideshows on the same page, normally they will all be separate instances and they all won't be initialized by slideshow()
Upvotes: 0
Reputation: 2196
Via jquery:
$('#elemId').bind('event(s)', function(e){
SlideShow();
})
Smth like this, if i understood it correctly.
Upvotes: 1