I wish that when a user positions the mouse in a hyperlink, a set of sublinks will show up. It flips and flops as the user moves in and out the mouse towards it. How can I do this?

Thanks. I really appreciate your reply.

Recommended Answers

All 2 Replies

This is done through javascript and visibility. You can also do it through CSS.

For javascript:
on your hyperlink add an onmouseover, onmouseout event(s) that call the specific function.

On that function, check to see if that submenu is visible. If it is, make it "hidden", if not, make it visible. An example of this is below:

<script type="text/javascript">
<!--//
function showMenu(id) {
  id = document.getElementById(id);
  if (id.style.visibility == '' || id.style.visibility == 'block') {
    id.style.visibility = "hidden";
  } else {
    id.style.visibility = '';
  }
-->
</script>

<a href="#" onmouseover="showMenu('menuName')">Link</a>
<div id="menuName" onmouseout="showMenu('menuName')">link1<br />link2<br /></div>

Now this code is very simple, so you can expand off of it easily. This should just give you an example of where to go!

Thanks buddy! You're the best...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.