Onfocus Tooltips
Apr 22, 2003
This HTML and CSS:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>onfocus tooltips</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<style type="text/css">
<!--
div.tooltip,div.heretooltip {
font:0.7em verdana,helvetica,arial,sans-serif;
border:1px solid #000;
background-color:#ffffe1;
color:#000;
padding:2px 4px 2px 4px;
text-align:left;
filter:progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135,strength=1);
position:absolute;
width:auto;
height:auto;
}
div.heretooltip {
border:1px solid #003;
background-color:#fefefe;
color:#003;
}
-->
</style>
</head>
<body>
<script type="text/javascript" src="tooltips.js"></script>
<p>Use the TAB and Shift-TAB keys to navigate this list.</p>
<ul>
<li><a href="/" title="Home Page" tabindex="10">Home</a>
<ul>
<li><a href="/sitemap.php" title="A guide to the areas of this website" tabindex="20">Sitemap</a></li>
<li><a href="/preferences.php" title="Change the design scheme and functionality" tabindex="30">Preferences</a></li>
<li><a href="/brothercake.php" title="About this site and its webmaster :)" tabindex="40">About brothercake</a></li>
</ul>
</li>
</ul>
</body></html>
And this in tooltips.js
// global vars
var i, pos, obj, tempObj, tempEle, winSize, extent, scrollHeight;
//toolTip object
var toolTip = null;
var toolTipParent = null;
//find object position
function getRealPos(ele,dir)
{
(dir=="x") ? pos = ele.offsetLeft : pos = ele.offsetTop;
tempEle = ele.offsetParent;
while(tempEle != null)
{
pos += (dir=="x") ? tempEle.offsetLeft : tempEle.offsetTop;
tempEle = tempEle.offsetParent;
}
return pos;
}
//delay timer
var goTip = false;
var goTimer = null;
function focusTimer(e)
{
//second loop
if(goTimer != null)
{
//clear timer
clearInterval(goTimer);
goTimer = null;
//pass object to create tooltip
focusTip(e);
}
//first loop
else
{
//get focussed object
(e) ? obj = e.target : obj = event.srcElement;
//pass object back through timer
tempObj = obj;
//set interval
goTimer = setInterval('focusTimer(tempObj)',400);
}
}
//create tooltip
function focusTip(obj)
{
//remove any existing tooltip
blurTip();
//if tooltip is null
if(toolTip == null)
{
//get window dimensions
if(typeof window.innerWidth!="undefined")
{
winSize = {
x : window.innerWidth,
y : window.innerHeight
};
}
else if(typeof document.documentElement.offsetWidth!="undefined")
{
winSize = {
x : document.documentElement.offsetWidth,
y : document.documentElement.offsetHeight
};
}
else
{
winSize = {
x : document.body.offsetWidth,
y : document.body.offsetHeight
};
}
//create toolTip
toolTip = document.createElement('div');
//add classname
toolTip.setAttribute('class','');
toolTip.className = (obj.className == 'youAreHere') ? 'heretooltip' : 'tooltip'
//get focussed object co-ordinates
if(toolTipParent == null)
{
toolTipParent = {
x : getRealPos(obj,'x') - 3,
y : getRealPos(obj,'y') + 2
};
}
// offset tooltip from object
toolTipParent.y += obj.offsetHeight;
//apply tooltip position
toolTip.style.left = toolTipParent.x + 'px'
toolTip.style.top = toolTipParent.y + 'px'
//write in title attribute (with 'you are here' string)
toolTip.innerHTML = (obj.className == 'youAreHere') ? obj.title + ' <b>[You Are Here]</b>' : obj.title;
//add to document
document.body.appendChild(toolTip);
//restrict width
if(toolTip.offsetWidth > 300)
{
toolTip.style.width = âÆpx'
}
//get tooltip extent
extent = {
x : toolTip.offsetWidth,
y : toolTip.offsetHeight
};
//if tooltip exceeds window width
if((toolTipParent.x + extent.x) >= winSize.x)
{
//shift tooltip left
toolTipParent.x -= extent.x;
toolTip.style.left = toolTipParent.x + 'px'
}
//get scroll height
if(typeof window.pageYOffset!="undefined")
{
scrollHeight = window.pageYOffset;
}
else if(typeof document.documentElement.scrollTop!="undefined")
{
scrollHeight = document.documentElement.scrollTop;
}
else
{
scrollHeight = document.body.scrollTop;
}
//if tooltip exceeds window height
if((toolTipParent.y + extent.y) >= (winSize.y + scrollHeight))
{
//shift tooltip up
toolTipParent.y -= (extent.y+obj.offsetHeight+4);
toolTip.style.top = toolTipParent.y + 'px'
}
}
}
function blurTip()
{
//if tooltip exists
if(toolTip != null)
{
//remove and nullify tooltip
document.body.removeChild(toolTip);
toolTip = null;
toolTipParent = null;
}
//cancel timer
clearInterval(goTimer);
goTimer = null;
}
window.onload = function()
{
if(typeof document.getElementsByTagName!="undefined")
{
//get tags collection
var allTags = document.getElementsByTagName('*');
var allTagsLen = allTags.length;
for (var i=0;i<allTagsLen;i++)
{
//if tag has title attribute
if(allTags[i].title)
{
//attach event
allTags[i].onfocus = focusTimer;
allTags[i].onblur = blurTip;
allTags[i].onmouseover = blurTip;
}
}
}
}
View 21 Replies
ADVERTISEMENT
Jul 23, 2005
I am trying to do a mouseover with tooltips with an XSL stylesheet. I
want to be able to pick data from the XML using the syntax
<xsl:value-of select="CHALLENGE_REMARKS"/> How do I send the data
from this element to the doToolTip function.
Ex.
<td>
select="CHALLENGE_REMARKS"/>) </td>
This does not work. I have tried putting the element in a var and
this works except when there are multiple rows the mouseover tooltip
only displays the data for the last row for all rows.
View 3 Replies
View Related
Jun 22, 2010
I'm sure some of you guys are familiar with the jquery plugin, tipsy. I want to be able to display HTML inside the tooltip but more like a div layer (<div id="tweet"></div>). I noticed I can put tags like bold and italic text inside the tooltip but not full divs. How would I go about doing that? I'm trying to display a twitter script by seaofclouds inside the tooltip. The script looks like this:
[Code]...
View 2 Replies
View Related
Apr 14, 2011
I'm using Tipsy on my site and in IE7/8 I get a double tooltip when I hover over an element.I've looked around for a fix but can't find any reliable solutionAttachments Screen shot 2011-04-14 at 1.40.54 PM.pngSize : 11.93 KB Download : 317
View 1 Replies
View Related
Aug 25, 2010
i'm trying to hide title and alt tooltips from popping up. i realized that tooltip plugins can hide the browser tooltip and display their own generated style. i am using plugins like fancybox and cycle which have been configured to use attributes for links and description therefore i need title/alt.
i've been unsuccessfully trying to write a function that onmousehover saves the title/alt attribute and empties the attributes (alt="" title="") so they don't popup, then restores them onmouseout.
i know it has something to do with .data() but I can't seem to get it working. i've tried breaking down very simple tooltip plugins, but once i start removing lines of code, it doesn't do anything.
View 4 Replies
View Related
Oct 31, 2009
I'm currently generating some tooltips to display data for certain items in a game. The tooltips and stats work great, however, for certain items, the tooltip gets long and will extend pass the viewable range for the user.
Here are the links:
test page: [URL]
javascript: [URL]
css (for hover div only): [URL]
If you hover over the links of items (like villages, barracks, etc.) a tooltip will pop up to show you the stats. But if you notice, for items like castles, the tooltip can extend past the viewable range for the user.
View 1 Replies
View Related
Jun 16, 2011
I have this photo gallery that I'm setting up where I've used some jquery to pop a magnified view of an image when the mouse is hovered over the thumbnail. As it is right now, it always positions the magnified image with the top-left corner at the x and y position of the mouse cursor. What I need it to do is if the image is going to be displayed beyond the viewport, that it would change its positioning to the corner that will show the whole image.
[Code]...
View 2 Replies
View Related
Jul 16, 2011
I sourced the codes and made some changes, but I need to know a better way to add multi-tooltips on the phone image when its selected by mouse move event. I need an example of the codes that will work on 360.On the site you can look at the source-codes to see where Im going.
View 5 Replies
View Related
Apr 5, 2010
I have a grammar check on the server that can grammar check text... big surprise there. It'll return a list of match problems, along with the positions in the text that are flawed. It'll also send the grammar rule that was broken in plain english, to help someone fix it.
So we have a list of these basically:
What I'd like to do is apply different styles to the text inside of the <textarea> for all these positions (5 to 10 in the case above, but I'm going to have a list of these).
I also want to make it so if a user hovers on top one of these problems, I can show a tooltip that contains the "message" property.
View 5 Replies
View Related
May 26, 2011
Demo page illustrating current issue:[URL]... I'm calling different tooltip DIVs from different triggers.Using bodyHandler, each trigger has a unique corresponding DIV To keep a clean document, i've grouped the tooltip DIVs at the bottom of the source When you hover over triggers, the correct tooltip is displayed However, the tooltip displays at the bottom of the page, not tracking with cursor.
How can i group my DIVs away from my trigger markup and still achieve tooltips that track with mouse cursor?
View 4 Replies
View Related
Sep 8, 2009
I have some simple tooltips on my site that load the content of the "title" tag into the tooltip. I am currently using this plugin[URL].. I have tried several others. They all work fine for static elements, but the main content of my pages are loaded by an ajax load() call. The tooltips don't work on any this content loaded via ajax. Why is this happening and is there a way to fix this? Or maybe a tooltip plugin that will work for this?
View 4 Replies
View Related
Apr 13, 2010
I'd like to find certain keywords in the text of an html page and give it an underline and the ability to show a tooltip when hovered. When I try to use .text() on the top-level element, it just spits everything out, including javascript, etc. How can I go through line-by-line and do a word comparison with the keyword I'd like highlighted? I'm thinking of basically doing:
$(#toplevel).each(function () {
if ($(this).text() == 'keyword')
$(this).contents().filter(return this.nodeType == 3).wrap('<a></a>');
If that makes any sense.
View 72 Replies
View Related
Nov 17, 2005
I am working on editing an events calendar that uses tooltips. I am using javascript from Walter Zorn . The page is valid xhtml strict and uses valid css and things work fine in Firefox. But in IE the tooltips are the wrong size and the border/padding on the right side is much too wide. Can anyone look at Zorn's javascript (#1 google result for "tooltip") or my code and see if it needs some IE hack.
View 1 Replies
View Related
Feb 4, 2011
I have a scenario where I show a drop-down-with-few-items in a JSP page, to the user.
The length of few options in the drop down is greater than that of the drop down's, hence our requirement is to show the hovered (not selected) option as tooltip for user's convenience. I am not able to use title attribute for displaying tooltips in my browser.
Now the code ...
implements a tooltip for multiple select drop down menu.Can you modify the code for single select
View 1 Replies
View Related
Aug 17, 2011
The site in question: [url]
The problem: Popups work fine, as they open the mini thumbnails when you mouseover. However, as you scroll down the page, the images move with you. So, if you mouseover'd the top result (having not scrolled down) the graph would appear when it was supposed to. However, if you scrolled down 200px, and then mouseover'd the top result (or any result), the thumbnail would popup 200px lower than it should.
The guide site I used: [url]- it doesn't happen on their site.
I set up a dummy site of their site: [url]- I just copied the source code for everything and changed literally nothing. It still happens on my version of the site.
<script type="text/javascript" src="ddimgtooltip.js">
View 2 Replies
View Related
May 3, 2011
i working on web map of MMORPG gamehttp:[url].....(here is "working" version dont comment a code, its shitty i working on funkcionality,i will perform code cleaning and optimalizacion after i implement all needed functions and solve all my problems)so i have 2 problems:
1) map performance when zooming.i need drawn ~600 dots of NPCs on map and recalculate their positions on map when zoom in/out, my current solution is slow ( cleaning and appending HTML into map content) i wana know if there is faster solution how do it ?
2)i using jQuery tooltips to show data when NPC or fort icon is mouseovered , it works great only with one problem, when i zoom with tooltip opened , it loose "connecion" with fort/NPC icon and tooltip stuck on screen...
View 3 Replies
View Related
Jun 7, 2009
I want o make tooltip on mouseover of different links which displays the tooltips in div & which works on both browsers
View 8 Replies
View Related
Jul 23, 2005
Here is the layout of my form from left to right, from top to down.
- buttonA, buttonB, buttonC
- textbox, textbox, textbox
- buttonXXX
After the user types in the textboxes and press enter (with the cursor still
in one of the textboxes), buttonXXX should be pressed by default.(the user
is too lazy to take the cursor over to buttonXXX and click).
The problem is the top/left most button (button A) gets pressed which annoys
them to death. So I tried to do this.
In the bottonA's onfocus event handle-
document.forms[0].elements['buttonXXX'].focus() .
Result: ButtonXXX receives focus alright, but the code for buttonA still
executes!
View 1 Replies
View Related
Jul 23, 2005
For those who have been using Outlook Express, you must be pretty used to
the fact that whenever you focus on the preview section, the header for the
preview turns from grey to blue, while the text turns from black to white.
Code:
View 3 Replies
View Related
Jul 20, 2005
I'm fairly new to this and my code is as follows...
<script language="JavaScript>
var oldValue
function focusElement(theElement) {
oldValue = theElement.value;
return;
}
</script>
Then in the HTML, I have
<select size="1" id="ConfCommentSELECT" name="ConfCommentSELECT"
onfocus="return focusPrecedence(this);">
<option value="0"> - </option>
<option value="1">1</option>
<option value="2">2</option>
</select>
The <select> is with a <form><tr><td>, but I don't see how that would make a
difference. I started using the onchange="return blah-blah-blah(this);" and
that worked so I copied that to the onfocus. What I want to do is to
remember the value of the contents of the <select> before the user changes
it, and compare it to the new value.
View 2 Replies
View Related
Mar 9, 2005
1. How to reset textbox + textarea?
2. How to make the "function getKeyValue_h(chr)" work without the submit button? (on pasting in textarea it should automatically give the calculated result in the textbox.)
View 3 Replies
View Related
Nov 2, 2009
I'm using custom javascript tooltips to show information about designs in a t-shirt shop, such as design name and artist. I downloaded the code and CSS for the tooltips and am attempting to assign the tooltip to each design using a javascript array and a for-in loop. Only problem is that the tooltips aren't showing at all, no matter what I do. I think the problem is related to the onmouseover event that I'm using, but the only thing that seems to work even partway is changing the visibility to "show" in the CSS. From that I can see that the text is being assigned to the tooltips properly and that they are being positioned within the window, but the onmouseover event is having no effect either way when I revert the visibility back to "hidden."
[Code]...
View 6 Replies
View Related
Oct 8, 2005
I'm developing a website where a visistor does not have to use the mouse.
All he has to do is use the Tab-key or key-combinations to jump to specific
hyperlinks (containing accesskeys). Next, he presses the Enter key to follow the hyperlink.
My question is: is it possible to change color of the hyperlink when a
hyperlink get the focus. I do not only want to see the dotted line, I want the hyperlink to lighten up.
View 11 Replies
View Related
Sep 13, 2011
My code works perfectly inside DreamWeaver but is crazy in both IE8 and FireFox.
In FireFox, I cannot insert text in the text fields.
In IE8, I can insert text, but nothing else happens.
My code is as follows:
Code:
<script language="JavaScript">
<!--
var Counter;
[Code].....
View 5 Replies
View Related
Sep 22, 2005
I've got a default value of some text in an input element when a page loads.
What I'd like to do is have the value disappear when the user clicks in the
input field.
I've figured out I can use:
onclick="this.value=''"
This works fine, however if for some reason the user adds his own input,
then click somewhere else/clicks back, the text has once again been erased.
So I thought of a function like the following, however it does not work:
function removeinput(x) {
if (x == 'Enter items not on standard list here...') {
x = ''
}
}
onclick="removeinput(this.value);"
I've also tried placing this.value inside of single quotes to no avail.
View 5 Replies
View Related
Aug 31, 2009
Setting the min to 0 will dispaly all the optins if the user clicks the field a 2nd time. However, i'd like the options to display once the input has focus, or using a button. How can I do that?
View 1 Replies
View Related