SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    0 Post(s)
    0 Thread(s)

    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. 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.
    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. Any ideas why in FF they don't work but in GC and IE they do??

    Best Regards,

    Gustavo P.
    Last edited by Mittineague; Jun 23, 2011 at 16:59. Reason: Please wait until you get your signature for your links.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts