Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help me for vertical scrolling

    I'm new to java scripting...i searched on the net for the scrolling of text vertically...The text should be scrolled from top to bottom on the right side side of the page..please help me to do this...

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,521
    Thanks
    3
    Thanked 507 Times in 494 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function ScrollText(){
     var obj=document.getElementById('tst')
     obj.style.top=(obj.offsetTop+1)+'px';
     if (obj.offsetTop>zxcBdyWH()[1]){
      obj.style.top=(0)+'px';
     }
     obj.parentNode.style.left=(zxcWWHS()-obj.parentNode.offsetWidth)+'px';
     obj.parentNode.style.height=(zxcBdyWH()[1])+'px';
    }
    
    
    function zxcBdyWH(){
    if (document.body.scrollHeight>document.body.offsetHeight){return [document.body.scrollWidth,document.body.scrollHeight]; }
     return [document.body.offsetWidth,document.body.offsetHeight];
    }
    
    
    
    function zxcWWHS(){
     if (window.innerHeight){ return window.pageXOffset; }
     else if (document.documentElement.clientHeight){ return document.documentElement.clientWidth; }
     return document.body.clientWidth;
    }
    
    
    
    function InitScroll(){
     setInterval('ScrollText()',10); // set the speed heer
    }
    
    //-->
    </script>
    </head>
    
    <body onload="InitScroll();">
    <!--Adjust to suit -->
    <div style="position:absolute;top:0px;width:100px;" >
    <div id="tst" style="position:absolute;top:100px;width:200px;" >Some Text</div>
    </div>
    <div style="height:2000px" ><!--demo only for page height--></div>
    
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks alot!!...but the scrolling text should be in vertical position....please help me to do this...

    Thanks again!!

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,521
    Thanks
    3
    Thanked 507 Times in 494 Posts
    well separate each letter with a <BR>

    if there is a lot of text


    div.innerHTML=div.innerHTML.split('').join('<BR>');
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks....but you did n't get what exactly I mean.....if v use '<br>' the letters would scroll one at each line...but I need the scrolling letters should be in vertical position.....please help me...

    thanks again!!!

  • #6
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Code:
    div.innerHTML=div.innerHTML.split('').reverse().join('<BR>');

  • #7
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks a lot...can u please tell me where should I insert the above code line(div.innerHTML=div.innerHTML.split('').reverse().join('<BR>');) in the original code....please help me...

    thanks again!!!

  • #8
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    anybody please help me..

    i wanna know..where shud be the above line ( posted by shyam) added in the code....please specify the position......


  •  

    Posting Permissions

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