...

View Full Version : help me for vertical scrolling



sudhee
02-21-2007, 06:56 AM
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...

vwphillips
02-21-2007, 02:29 PM
<!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>

sudhee
02-22-2007, 07:19 AM
thanks alot!!...but the scrolling text should be in vertical position....please help me to do this...

Thanks again!!

vwphillips
02-22-2007, 12:56 PM
well separate each letter with a <BR>

if there is a lot of text


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

sudhee
02-22-2007, 08:48 PM
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!!!

shyam
02-22-2007, 08:54 PM
div.innerHTML=div.innerHTML.split('').reverse().join('<BR>');

sudhee
02-22-2007, 09:53 PM
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!!!

sudhee
02-23-2007, 10:39 PM
i wanna know..where shud be the above line ( posted by shyam) added in the code....please specify the position......



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum