JavaScript Help??
-
Hi I would like to know "how to stop vertical scrolling text in javascript after one iteration". What i have is the text that scrolls continuously, and i want it to make it stop at the top of the box. How can i acheive this effect?? This is the javascript i have; <script language="JavaScript"> function getObject( obj ) { var strObj if ( document.all ) { strObj = document.all.item( obj ); } else if ( document.getElementById ) { strObj = document.getElementById( obj ); } return strObj; } var theTop = 200; var theHeight = 100; var theWidth = 150; var theLeft = 350; var toClip = 200; function scrollNews( newsDiv, toMove ) { theDiv = getObject( newsDiv.toString() ); if ( theDiv == null ) { return; } if ( document.layers ) { theDiv.clip.top = toMove; theDiv.clip.bottom = toMove + toClip; theDiv.top = theTop - toMove; } else { theDiv = theDiv.style; theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)"; theDiv.top = theTop - toMove + 'px'; } if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight - 20 ) ) { toMove = 0; if ( document.layers ) { theDiv.clip.top = theTop; theDiv.clip.bottom = toClip; theDiv.top = theTop } else { theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)"; theDiv.top = theTop + 'px'; } } toMove = (toMove + 2); //speed of scroll setTimeout("scrollNews('" + newsDiv + "'," + toMove + ")", 100); } </script> Any help is much appreciated
Cheers :)
-
Hi I would like to know "how to stop vertical scrolling text in javascript after one iteration". What i have is the text that scrolls continuously, and i want it to make it stop at the top of the box. How can i acheive this effect?? This is the javascript i have; <script language="JavaScript"> function getObject( obj ) { var strObj if ( document.all ) { strObj = document.all.item( obj ); } else if ( document.getElementById ) { strObj = document.getElementById( obj ); } return strObj; } var theTop = 200; var theHeight = 100; var theWidth = 150; var theLeft = 350; var toClip = 200; function scrollNews( newsDiv, toMove ) { theDiv = getObject( newsDiv.toString() ); if ( theDiv == null ) { return; } if ( document.layers ) { theDiv.clip.top = toMove; theDiv.clip.bottom = toMove + toClip; theDiv.top = theTop - toMove; } else { theDiv = theDiv.style; theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)"; theDiv.top = theTop - toMove + 'px'; } if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight - 20 ) ) { toMove = 0; if ( document.layers ) { theDiv.clip.top = theTop; theDiv.clip.bottom = toClip; theDiv.top = theTop } else { theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)"; theDiv.top = theTop + 'px'; } } toMove = (toMove + 2); //speed of scroll setTimeout("scrollNews('" + newsDiv + "'," + toMove + ")", 100); } </script> Any help is much appreciated
Cheers :)
why you are not using
Marquee
For that SetDirection="UP"
andBEHAVIOR="Slide"
Best Regards ----------------- Abhijit Jana Check Out My Latest Article Java.NET : Integration of Java and .NET[^] "Success is Journey it's not a destination"
-
why you are not using
Marquee
For that SetDirection="UP"
andBEHAVIOR="Slide"
Best Regards ----------------- Abhijit Jana Check Out My Latest Article Java.NET : Integration of Java and .NET[^] "Success is Journey it's not a destination"
Hi Yes i did think of that. However, Marquee is only compatible with IE. Other browsers like FireFox cannot interpret the tag. Thanks
Cheers :)