How can I execute a JavaScript function on page load not after?

Hello everyone, allow me to start off by saying you guys have a well disputed rep around the admin forums. This site comes very highly recommended and I see you guys have the content to back it up; super glad I joined. :slight_smile: So now to the java stuff…

I have been trying to work my way around this issue for some time now. I am trying to stop a marquee from scrolling as soon as the page start to load not after. I have been using this to pause the marquee with JavaScript but the command does not execute but after the page loads; after all the html loads.

This is the JavaScript:

<script language="JavaScript">
   function function1(){
        document.all.myMarquee.direction = "left";
    function function2(){
        document.all.myMarquee.direction = "right";    
    function function3(){
      function function4(){

This is what I insert in my template:

<marquee id="myMarquee" BEHAVIOR=ALTERNATE>&nbsp;{vb:raw film_seriti}a></marquee>
<img src="" onclick="function1();">
<img src="" onclick="function3();">
<img src="" onclick="function4();">
<img src="" onclick="function2();">

With this code the marquee does stop but after the page loads completely so as the page loads the marquee start to scroll and then stops as soon as the page finishes loading but with the first image of the marquee have way out. I need to be able to load the marquee 100% stopped as the page loads so then I can use the buttons I placed to control the marquee.

My question is:

Is there ANY way to completely stop the marquee from scrolling as soon as the page loads???

Any information anyone could share would be very much appreciated. Thank you for your time.

p.s: Also if anyone has any idea on how to scroll the marquee by click; meaning by every click of the mouse the marquee moves either left or right, would be even better. :slight_smile:
p.s: Noted that this code does NOT work in FF for some reason. The stop does not work and the buttons don’t respond. :frowning: Any ideas why in FF they don’t work but in GC and IE they do??

Best Regards,

Gustavo P.

Get rid of the proprietary marquee tag and rreplace it with a marquee script witten in JavaScript. That way the marquee will not start moving until the script that makes it move runs. Also it will then work in all browsers and not just in Internet Explorer.

Thank you so much for the rapid reply. Question though, I’m using {vb:raw film_seriti} to call the marquee contents; will this also be parsed within a JavaScript marquee? If so, of the top of your head do you know of any good JavaScript resources out there? Googleing as we speak but just wanted to know if you know of any you have had experience with. Thank you again for your feedback.

NOTE: I found some script that can work but there is only one problem, my content of the marquee is dynamic and as most script are in array I’m having a tough time finding the right one. If I could I would code it myself, learning daily though slowly but surely. :slight_smile: