PDA

View Full Version : Cool DHTML Tooltips script



jskarren
06-23-2005, 11:14 PM
I am trying to use the listed script inside an image map but appear to be missing something. I am not trying to link to another site, I just want the tooltip to appear and list text about the portion of the image map they are hovering over. Anyone have any ideas on what the correct code would be for this? Here is a brief example of what I am doing.

<MAP NAME ="descriptions">
<AREA SHAPE="rect" COORDS = "0, 30, 77, 549" HREF= onMouseover="ddrivetip('All functions in Essentials can be accessed from seven primary screens. They are always visible and can be reached from anywhere in the software',)";
onMouseout="hideddrivetip()"">

<AREA SHAPE="rect" COORDS = "83, 39, 91, 101" HREF="onMouseover="ddrivetip(This is some more text.')";
onMouseout="hideddrivetip()"">
</map>

Thanks in advance for any help.

Scott Karren

jscheuer1
06-24-2005, 02:05 AM
Image maps can give rise to hard to track down scripting problems even when the code is essentially correct or at least looks that way. I say this because once we clear up the obvious syntax problems, that is no guarantee things will work as expected. Add to that the fact that you may have other errors not shown in such an abbreviated code snippet . . .

Well that was a long way to go but, I'm fairly sure you've got the idea. Now, on to those obvious syntax problems. An href cannot equal a mouseover, a semicolon (if needed or optional) should lie at the end of a javascript code segment (not outside of quotes signifying that what follows is not javascript code) and a comma shouldn't follow a parameter unless also followed by another parameter, so try:
<MAP NAME="descriptions">
<AREA SHAPE="rect" COORDS="0, 30, 77, 549" HREF="#" onclick="return false;" onMouseover="ddrivetip('All functions in Essentials can be accessed from seven primary screens. They are always visible and can be reached from anywhere in the software')" onMouseout="hideddrivetip()">

<AREA SHAPE="rect" COORDS="83, 39, 91, 101" HREF="#" onclick="return false;" onMouseover="ddrivetip('This is some more text.')" onMouseout="hideddrivetip()">
</map>You were also missing a single quote at the beginning of "This is some more text" but, I figured that was just an honest typo (those will still break the code though). You can have COORDS = "0, 30, 77, 549" but the extra spaces around the equals sign are just that, extra. You do need spaces between attributes though. The attributes in the above are shape, coords, href, onclick, onmouseover, and onmouseout.

jskarren
06-28-2005, 07:54 PM
I forgot to post this before. Thanks for the reply, your suggestions worked perfectly for me. Thanks again.

dd2me
06-29-2005, 09:33 AM
try to slice the image into chunk