CoderZone.org

Category: >> JavaScript >> Variable Speed Horiz Scroll Bookmark and Share

<< lastnext >>

Snippet Name: Variable Speed Horiz Scroll

Description: Nice horizontal scroller with variable scroll speed.

Comment: (none)

Author: CoderZone
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 28th, 2009

< s c r ipt type="text/javascript">
 
var i;
i = 1
 
function scr() {
 
 d = document.getElementById("a")
 d.scrollLeft=i
 diff = (d.scrollWidth - d.offsetWidth)
 
 if(d.scrollLeft == diff) {
 d.scrollLeft = 0
 i = 1
 }
 
 i = i + 1
 window.setTimeout("scr()", 30)
}
</s c r ipt>
 
<div id="a" nowrap style="width:120px;height:20px;overflow:hidden">
 <Table cellspacing='0' cellpadding='0' width=100%>
  <tr>
   <td nowrap>
    <img src="a.gif" width=120px height=1>
     Hello World, I am testing my Scroll. Right to Left...enjoy!
    <img src="a.gif" width=120px height=1>
   </td>
  </tr>
 </Table>
</div>
 
 
<input type="button" value="go" onClick="scr()">
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 11