Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Hi Everyone,
    I am using the following script from the Javascript Source to scroll some text across the screen:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    <!-- (c) http://www.wyka-warzecha.com -->
    
    <!-- Begin
    // THESE VARIABLES CAN BE CHANGED //
    var myMainMessage="  Try this out! The message just keeps repeating. Use it for announcements, news and other items! ";
    var speed=150;
    var scrollingRegion=50;
    
    // END CHANGEABLE VARIABLES //
    var startPosition=0;
    function mainTextScroller() {
            var mainMessage=myMainMessage;
            var tempLoc=(scrollingRegion*3/mainMessage.length)+1;
            if (tempLoc<1) {tempLoc=1}
            var counter;
            for(counter=0;counter<=tempLoc;counter++)
               mainMessage+=mainMessage;
    document.mainForm.mainTextScroller.value=mainMessage.substring(startPosition,startPosition+scrollingRegion);
            startPosition++;
            if(startPosition>scrollingRegion) startPosition=0;
            setTimeout("mainTextScroller()",speed); }
    //  End -->
    </script>
    My text seems to be longer than the sample, so it seems to just stop and start over about halfway through.

    Javascript is not my expertise, so I am uncertain what to alter in the script in order for it to run longer so that my text completes its cycle before looping. Can some advise me on what to do?

    Thanks in advance.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Try adjusting the scrollingRegion to a higher value. I'd say around 150-200.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Quote Originally Posted by TheGAME1264 View Post
    Try adjusting the scrollingRegion to a higher value. I'd say around 150-200.
    I actually had to increase it to about 600 - and it worked! Thank you for your assistance.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    No problem. I'm a bit surprised it needed to be that high, but not totally.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:26 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com