jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Mouse Positioning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Mouse Positioning" Watch "Mouse Positioning" New topic
Author

Mouse Positioning

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 818
Heres the situation: I have a table with 1 row and 5 columns. Each cell is going to act as a parent menu option. When I move the mouse over each cell there will be a menu showing up underneath the appropriate parent option. On the Adobe website is a good example of what I'm trying to do (i.e. the dropdown menus). I have each sub-menu created as tables that are surrounded by DIV tags, I then set the visibility to be true when the mouseover event occurs.

What I want to know is : how do you determine the mouse position on a mouseover? Since I'm using percentages is there a way of determining the position of a cell when re-sizing (i.e. the parent cells in this case) so that I can then set the position of the sub-menu accordingly if the window gets resized? On initializing the window I use stylesheets for the submenus' DIV tags (i.e. basically visibility: hidden but this doesn't seem to work in Netscape 4.X). I know this is an older browser but some customers still use this browser (corporations aren't quick on implementing such things as new broswers so I would like to handle 4.X browsers as much as possible). If someone could answer these questions could you try and keep in mind I'm trying to support as many versions of IE and Netscape as possible. Thanks so much.

Rob
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
With showing and hiding with Netscape 4.X you are going to go through hell since it requires a lot more pain in the butt stuff to do.

This code might help you in finding the position:

http://www.coderanch.com/t/114176/HTML-JavaScript/Coordinates-objects-without-Absolute-postioning

Showing and Hiding layers
http://www.geocities.com/technofundo/tech/js/showhide.html

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Mouse Positioning