 |
HTML Help Please Search for the answer to your question before asking it! Thanks.
|
| View previous topic :: View next topic |
| Author |
Message |
Martyr
Joined: 29 Sep 2009
Posts: 1
|
| Posted: Tue Sep 29, 2009 8:18 pm Marquee Scrollamount Change button |
|
|
I am making a page where the text scrolls, and I need the code to alter the speed for the scrolling via a button. I'm not exactly sure how to do this. I can create the buttons, but having them alter the scrollamount for the marquee for the page is eluding me. If anyone could assist me in this, I would be rather grateful. I'll put the code in that I have already and hopefully someone could tell me what I'm not doing, or am doing wrong. I'm not including the content of the page, because it's adult only and I can't verify that every user of this site is over the age of legality in their area. Code: <div align=center>
Scroll Speed: <INPUT TYPE=Button NAME="4" SIZE=10>
<BUTTON
TYPE=BUTTON
onClick=<marquee scrollamount=4>Speed=4</BUTTON>
<BUTTON
TYPE=BUTTON
onClick=<marquee scrollamount=3>Speed=3</BUTTON>
<BUTTON
TYPE=BUTTON
onClick=<marquee scrollamount=2>Speed=2</BUTTON>
<BUTTON
TYPE=BUTTON
onClick=<marquee scrollamount=1>Speed=1</BUTTON>
<BUTTON
TYPE=BUTTON
onClick=<marquee scrollamount=0>Speed=0</BUTTON>
</div>
<br> |
|
|
PayneLess Designs
Joined: 28 Feb 2007
Posts: 3598
Location: Biloxi, MS
|
| Posted: Tue Sep 29, 2009 10:21 pm |
|
|
Not exactly using buttons, but works:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<title>Marquee Speed Control</title>
<meta http-equiv="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Wed, 30 Sep 2009 06:11:55 GMT">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<script type="text/javascript"><!--
function speedUp(){
speed=document.getElementById("scroller").scrollAmount;
speed+=1;
document.getElementById("scroller").scrollAmount=speed;
}
function speedDown(){
speed=document.getElementById("scroller").scrollAmount;
speed-=1;
if(speed<=0){
speed=0;
}
document.getElementById("scroller").scrollAmount=speed;
}
//--></script>
<style type="text/css">
div#marquee_wrap {
width: 400px;
line-height: 2em;
margin: 0 auto;
border: 1px solid #f0f;
text-align: center;
}
#marquee_wrap marquee {
background: #fff;
color: #f0f;
font-family: arial, 'times new roman';
font-size: 1em;
font-weight: bold;
}
#marquee_wrap p a {
padding-left: 5px;
text-decoration: none;
text-align: center;
word-spacing: 2em;
background: #007;
color: #fff;
}
#marquee_wrap p a:hover {
color: #ff0;
text-decoration: blink; /* doesn't work in IE */
}
</style>
</head>
<body>
<div id="marquee_wrap">
<marquee id="scroller" behavior="scroll">Your Marquee Message Here!</marquee>
<p><a href="#null" onclick="speedUp();return false">UP☝</a> <a href="#null" onclick="speedDown();return false">DOWN☟</a></p>
</div>
</body></html>
Style as you see fit. |
|
|
| |
|
|
|
Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group
|