Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8270511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:35:16+00:00 2026-06-08T06:35:16+00:00

I am trying to make ticker to scroll right to left from zero pixel

  • 0

I am trying to make ticker to scroll right to left from zero pixel of the page starts at left of the page.

Below is the code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <style type="text/css">
#marqueeborder {
    color: #cccccc;
    background-color:  #000000;
    font-family:Arial, Helvetica, sans-serif;
    position:relative;
    height:20px;
    overflow:hidden;
    font-size:.8em;
}
#marqueecontent {
    position:absolute;
    left:0px;
    line-height:20px;
    white-space:nowrap;
}
.stockbox {
    margin:0 10px;
}
.stockbox a {
    color: #cccccc;
    text-decoration : none;
    font-weight: 400;
}
  </style>
<script type="text/javascript">

    // Original script by Walter Heitman Jr, first published on http://techblog.shanock.com

    // Set an initial scroll speed. This equates to the number of pixels shifted per tick
    var scrollspeed=3;
    var pxptick=scrollspeed;
var marqueediv='';
var contentwidth="";
var marqueewidth = "";
    function startmarquee(){
        //alert("hi");
        // Make a shortcut referencing our div with the content we want to scroll
        marqueediv=document.getElementById("marqueecontent");
        //alert("marqueediv"+marqueediv);
    //  alert("hi"+marqueediv.innerHTML);

        // Get the total width of our available scroll area
         marqueewidth=document.getElementById("marqueeborder").offsetWidth;
        //alert("marqueewidth"+marqueewidth);
        // Get the width of the content we want to scroll
         contentwidth=marqueediv.offsetWidth;
    //  alert("contentwidth"+contentwidth);
    /// // Start the ticker at 50 milliseconds per tick, adjust this to suit your preferences
        // Be warned, setting this lower has heavy impact on client-side CPU usage. Be gentle.
        var lefttime=setInterval("scrollmarquee()",50);
        //alert("lefttime"+lefttime);
    }

    function scrollmarquee(){
        // Check position of the div, then shift it left by the set amount of pixels.

        if (parseInt(marqueediv.style.left)>(contentwidth*(-1)))
            marqueediv.style.left=parseInt(marqueediv.style.left)-pxptick+"px";
        //alert("hikkk"+marqueediv.innerHTML);}
        // If it's at the end, move it back to the right.
        else{
        //  alert("marqueewidth"+marqueewidth);
            marqueediv.style.left=parseInt(marqueewidth)+"px";
        }
    }

    //window.onload=startmarquee;

</script>
 </head>

 <body>
  <div id="marqueeborder" onmouseover="pxptick=0" onmouseout="pxptick=scrollspeed">

<div id="marqueecontent">


<?php

    // Original script by Walter Heitman Jr, first published on http://techblog.shanock.com

    // List your stocks here, separated by commas, no spaces, in the order you want them displayed:


</div>
</div>

 </body>
</html>

Edit

Attached screenshot below.

How it should look like

Edit2:
oh i missed its index.php

<html>
<body>

<?php include 'stockticker.php'; ?>

<h1>Welcome to index page!</h1>

</body>
<script type="text/javascript">
function onloadfun(){
startmarquee();

}
window.onload=onloadfun;
</script>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:35:17+00:00Added an answer on June 8, 2026 at 6:35 am

    Ok, here you go..
    there was problem in your scrollmarquee function. Replace it’s content with these

    if (parseInt(marqueediv.offsetLeft)>=(contentwidth*(-1))){
        console.log(parseInt(marqueediv.offsetLeft)-pxptick+"px");
        marqueediv.style.left = parseInt(marqueediv.offsetLeft)-pxptick+"px";
    }else{
        marqueediv.style.left=parseInt(marqueewidth)+"px";
    }
    

    The condition had to be reversed. Now it’s all great
    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following code in my HTML form - trying to make a
I'm trying make this code which is from a Dictionary of Arrays (CODE) from
Trying to make the infamous checkall checkbox for dynamically created rows from a MySQL
Trying to make a cross protocol, same domain request from https to http. I
im trying make one replace in string from a array but this dont work
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
I am trying to use Django's generic views to make a user registration page.
I'm trying make a login window where a user is prompted to enter their
I'm trying make an entity with doctrine that has three associations with other entities
I am trying make long screen to vertical direction. So, I need a screen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.