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');">«</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');">»</a></p>
</td>
</tr>
</table>
</body>
</html>
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');">«</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');">»</a></p>
</td>
</tr>
</table>
</body>
</html>