Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript Marquee Scroller 1

Status
Not open for further replies.

lupus42

Programmer
Jul 27, 2007
1
US
I have almost no experience in JavaScript, and I'd really appreciate help for this.
The following code is supposed to scroll only when you press and hold the arrow buttons. When you press the left arrow button, it should scroll to the left, and when you press the right arrow button, it should scroll to the right. Before/after you press the buttons, the marquee should do nothing. Can anyone help me accomplish this?
I wrote the following code:
<html>
<head>
<script language="JavaScript" type="text/javascript">
function marquee_scroller(direction, speed)
{
document.getElementById("marquee").direction = direction;
document.getElementById("marquee").speed = speed;
}
</script>
</head>
<body>
<table width="100%" height="14">
<tr>
<td width="2%">
<a href="#" onMouseDown="marquee_scroller('left', '4');" onMouseUp="marquee_scroller('right', '0');">&laquo;</a>
</td>
<td width="96%">
<marquee width="100%" height="12" id="marquee" scrollAmount="0" behavior="slide">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</marquee>
</td>
<td width="2%">
<p align="right"><a href="#" onMouseDown="marquee_scroller('right', '4');" onMouseUp="marquee_scroller('left', '0');">&raquo;</a></p>
</td>
</tr>
</table>
</body>
</html>
 
Hi

While [tt]marquee[/tt] is not a standard tag, I would not expect a predictable behavior. Especially when combined with scripting. With the following modification will work in Mozillas :
Code:
function marquee_scroller(direction, speed)
{
  document.getElementById("marquee").direction = direction;
  document.getElementById("marquee").[red]scrollAmount[/red] = speed;
}
I suggest to google for "dhtml scroller" and pick a pure JavaScript solution.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top