PDA

View Full Version : Text scroller.....direction change with 'ul'



gravesit
11-06-2006, 11:16 PM
One is possible to scroll text horizontial with an unordered list?

if so how do you do it with my code....cant figure it out. I change the scroll style to left or right and it doesnt work.

Thanks for the help.


var dn_startpos=120;
var dn_endpos=-200;
var dn_speed=30;
var dn_newsID='news';
var dn_classAdd='hasJS';
var dn_stopMessage='';
var dn_paraID='DOMnewsstopper';

window.onload=function()
{
if(!document.getElementById || !document.createTextNode){return;}
initDOMnews();
}
window.onunload=function()
{
clearInterval(dn_interval);
}


var dn_scrollpos=dn_startpos;
function initDOMnews()
{
var n=document.getElementById(dn_newsID);
if(!n){return;}
n.className=dn_classAdd;
dn_interval=setInterval('scrollDOMnews()',dn_speed);
var newa=document.createElement('a');
var newp=document.createElement('p');
newp.setAttribute('id',dn_paraID);
newa.href='#';
newa.appendChild(document.createTextNode(dn_stopMessage));
newa.onclick=stopDOMnews;
newp.appendChild(newa);
n.parentNode.insertBefore(newp,n.nextSibling);
n.onmouseover=function()
{
clearInterval(dn_interval);
}
n.onmouseout=function()
{
dn_interval=setInterval('scrollDOMnews()',dn_speed);
}
}

function stopDOMnews()
{
clearInterval(dn_interval);
var n=document.getElementById('news');
n.className='';
n.parentNode.removeChild(n.nextSibling);
return false;
}
function scrollDOMnews()
{
var n=document.getElementById(dn_newsID).getElementsByTagName('ul')[0];
n.style.top=dn_scrollpos+'px';
if(dn_scrollpos==dn_endpos){dn_scrollpos=dn_startpos;}
dn_scrollpos--;
}