Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

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<-------------------(scrolling)--------------------------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('slider').innerHTML=message
          slideit()
     }
     function slideit()  {
          if(document.getElementById('slider').style.pixelLeft > 5)  {
               document.getElementById('slider').style.pixelLeft -= 10
               setTimeout('slideit()',1000)
          }
     }
//-->
</script>
<style>
<!--
#slider  {
     position:absolute;
     top:10;
     left:50;
}
-->
</style>
<body>
<div id='slider'></div>
<br>
<br>
<br><a href='main.html' onMouseOver='javascript:slidemsg("Main: The main page");'>Main</a><br>
<a href='sports.html' onMouseOver='javascript:slidemsg("Sports: Scores and stats for teams");'>Sports</a><br>
<a href='games.html' onMouseOver='javascript:slidemsg("Games: 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?
0
superslamwich
Asked:
superslamwich
1 Solution
 
mikkolsoftCommented:
Is this what you want to achieve?
<script language='javascript'>
<!--
          var pixelLeft = 50;
    function slidemsg(message)  {
         document.getElementById('slider').innerHTML=message
         slideit()
    }
    function slideit()  {
         if(pixelLeft > 5)  {
                                   document.getElementById('slider').style.left = pixelLeft;
              pixelLeft -= 10;
              setTimeout('slideit()',1000)
         } 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
0
 
COBOLdinosaurCommented:
See if this is fast enough.  You control spped with the scrolldelay (in milliseconds). Any value less than 60 requires the truespeed property, or the value will be set to 60.

<html><head> </head><body>

<marquee width="500" scrolldelay="10" truespeed>
Now it the time for all good men to come to the aid of the country</marquee>

</body>
</html>

Cd&
0
 
superslamwichAuthor Commented:
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?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
superslamwichAuthor Commented:
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!
0
 
lil_puffballCommented:
superslamwich,
I just thought I'd mention that you can also use scrollamount=#, this sets how many pixels the text will move every time.
0
 
COBOLdinosaurCommented:
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&
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now