Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JavaScript and onMouseOver and mouseTip

Posted on 2000-02-19
7
Medium Priority
?
203 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 600 total points
ID: 2567999
glad I could help. thanks. :-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

877 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