dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: JavaScript
Expertise: Intermediate
Aug 15, 2005

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Text Scrolling on a Click Event

This code scrolls the text left and right on the click event of < , >:

<html>
<head>
<script language="javascript">
   function ScrollBy(dir){
        var left = xdiv.scrollLeft;
        if (dir =='left')
           xdiv.scrollLeft = left - 30;
        else
           xdiv.scrollLeft = left + 30; 
   }
</script>
</head>
<body>
<table>
<tr>
<td><a onclick="ScrollBy('left'); return false" title="Click to scroll left side"><</a>
</td>
<td>
<div id="xdiv" style="overflow-x:hidden;width=150px;Height=10px">
<table><tr><td  bgcolor='yellow'>Yellow</td><td bgcolor='red'>
Red</td><td bgcolor='green'>Green</td><td bgcolor='blue'>Blue</td>
<td bgcolor='cyan'>Cyan</td>
</tr>
</table>
</div>
</td>
<td><a onclick="ScrollBy('right'); return false" title="Click to scroll right side">></a></td>
</tr>
</table>
</body>
</html>
Santhi Maadhaven
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date