superslamwich
asked on
sliding a message onmouseover
ok, its a pretty simple question. In my navigation, I have a bunch of links to different places. When the user puts their mouse over one of the links, i want a message telling about the page to scroll from left to right on the top of the navigation, and then stop when it hits the side:
message<------------------ -(scrollin g)-------- ---------- --------me ssage
I have tried using the html <marquee behavior='slide'> but it goes to slowly for my liking. I tried to mimick the effect but faster using javascript, but it will not work either. Here is the code:
<script language='javascript'>
<!--
function slidemsg(message) {
document.getElementById('s lider').in nerHTML=me ssage
slideit()
}
function slideit() {
if(document.getElementById ('slider') .style.pix elLeft > 5) {
document.getElementById('s lider').st yle.pixelL eft -= 10
setTimeout('slideit()',100 0)
}
}
//-->
</script>
<style>
<!--
#slider {
position:absolute;
top:10;
left:50;
}
-->
</style>
<body>
<div id='slider'></div>
<br>
<br>
<br><a href='main.html' onMouseOver='javascript:sl idemsg("Ma in: The main page");'>Main</a><br>
<a href='sports.html' onMouseOver='javascript:sl idemsg("Sp orts: Scores and stats for teams");'>Sports</a><br>
<a href='games.html' onMouseOver='javascript:sl idemsg("Ga mes: Fun games to pass the time with");'>Games</a>
There are other links as well, but these are just examples.
There is no error message, but the message does not slide across the screen.
Any idea's?
message<------------------
I have tried using the html <marquee behavior='slide'> but it goes to slowly for my liking. I tried to mimick the effect but faster using javascript, but it will not work either. Here is the code:
<script language='javascript'>
<!--
function slidemsg(message) {
document.getElementById('s
slideit()
}
function slideit() {
if(document.getElementById
document.getElementById('s
setTimeout('slideit()',100
}
}
//-->
</script>
<style>
<!--
#slider {
position:absolute;
top:10;
left:50;
}
-->
</style>
<body>
<div id='slider'></div>
<br>
<br>
<br><a href='main.html' onMouseOver='javascript:sl
<a href='sports.html' onMouseOver='javascript:sl
<a href='games.html' onMouseOver='javascript:sl
There are other links as well, but these are just examples.
There is no error message, but the message does not slide across the screen.
Any idea's?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that is the type of thing I want, the only problem is that with that script, if you move quickly from one to another, the words will speed up and go faster and faster and over and over. Is there any way to get it to not do that but keep the effect?
ASKER
sorry, i wrote the previous comment while COBOL was submitting his. It's actually to mikkolsoft.
Anyway...
that scrolldelay attribute works great, it's exactly what I was looking for.
Thanks a lot COBOLdinosaur!
Anyway...
that scrolldelay attribute works great, it's exactly what I was looking for.
Thanks a lot COBOLdinosaur!
superslamwich,
I just thought I'd mention that you can also use scrollamount=#, this sets how many pixels the text will move every time.
I just thought I'd mention that you can also use scrollamount=#, this sets how many pixels the text will move every time.
A pretty good description of the marquess properties here:
http://www.blooberry.com/indexdot/html/tagpages/m/marquee.htm
Glad we could help. Thanks for the A. :^)
Cd&
http://www.blooberry.com/indexdot/html/tagpages/m/marquee.htm
Glad we could help. Thanks for the A. :^)
Cd&
<script language='javascript'>
<!--
var pixelLeft = 50;
function slidemsg(message) {
document.getElementById('s
slideit()
}
function slideit() {
if(pixelLeft > 5) {
document.getElementById('s
pixelLeft -= 10;
setTimeout('slideit()',100
} else {
pixelLeft = 50;
}
}
//-->
</script>
I am not too sure about the pixelLeft property but it's an IE-only attribute and you might want to use offsetLeft instead. If that's not the effect you want, let me know.
Mikkol