Solved

JavaScript and onMouseOver and mouseTip

Posted on 2000-02-19
7
194 Views
Last Modified: 2008-03-04
I have a left-contents frame which is: without a scrollbar
and contains one tablecell with no-wrap set to true.

Some of the text in the frame is to long to be shown, because of the narrow frame.

The text in the table-cell looks like this:
Home
Gallery
  Gallery 1
  Gallery bla bla bla
  Gallery bla bla bal balablal

Is there a way in JavaScript to get the
x and y position of the text to i.e. 'Gallery1'?

And then call a function that displays the text in a similar way using the "Title="Gallery1" in IE which displays a mouse tip (beneath the mouse)...BUT!!! I want the mouse tip to be shown hopefully exactly over the original text (or as close as possible)

It is important that this customMouseTip is shown over the main-frame at the right of the contents-frame.

So why do I not use the Title="something" in IE... Well I want it to work in several browsers...

Thanks...

Erot
0
Comment
Question by:erot
7 Comments
 

Author Comment

by:erot
ID: 2537994
To see what I want, you can open the windows explorer.
Default it opens with 'two frames'
if you resize the left frame so some of the text is hidden, and then move the mouse pointer over text that is partly hidden behind the 'right-frame' then there will pop up a mousetip, exactly over the original text....

Erot
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2538155
This won't behave exactly that way, but you could use the "title" attribute:

<A href="www.nfl.com" title="Visit the NFL">Visit the NFL</a>

.... title also works on buttons, textareas, and other form elements (but not selects), also in div and layer tags.
0
 

Author Comment

by:erot
ID: 2538203
Hello knightEknight
Did you read my question??

As I know it Title tag do not work with netscape.... and this is one of the reasons I want to do it with JavaScript.

Please answer the questions.....

Erot
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 8

Expert Comment

by:jbirk
ID: 2538333
I don't believe it is possible to have a layer leave the constraints of the document (overlap the other frame) unless you get a priviledge in Netscape.  In IE, I have no idea if it's even possible...

Anyway, it's probably not worth signing your script for something like this.

Good luck!

-Josh
0
 
LVL 7

Expert Comment

by:nettrom
ID: 2539557
it's impossible to have layers crossing two frames, the browsers give each frame its own window instance, and layers can't go across windows.  so you'll have to have the tooltips in either the left or the right frame, and only there.

to answer the x&y-coordinate-question, yes, it's possible.  if you name your links (so they become anchors) the x&y-coordinates can easily be found (they can also be found keeping the links unnamed, but it's easier when they are named).

document.anchors['anchor_name'].x
document.anchors['anchor_name'].y

gives the x & y coordinates in Netscape 4.x.  getting the same coordinates in Internet Explorer is slightly more tricky because IE has an "offset to paren" way of doing things, and the offset is calculated relating to the parent element.  therefore, some fiddling around with functions is needed (since your links are inside a table).  example showing how to get Y-coordinate of an item:

MTMyval = MTMGetPos('anchor_name');
function MTMGetPos(myObj) {
  return(myObj.offsetTop + ((myObj.offsetParent) ? MTMGetPos(myObj.offsetParent) : 0));
}

to get the X-coordinate, copy the function, rename it, change "offsetTop" to "offsetLeft".
0
 

Author Comment

by:erot
ID: 2567954
To Nettrom.
Please put in some text so I can give you the points.

Erot
0
 
LVL 7

Accepted Solution

by:
nettrom earned 150 total points
ID: 2567999
glad I could help. thanks. :-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question