HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
display tooltip text for option tag
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
ehatimk



Joined: 19 Jan 2005
Posts: 1

PostPosted: Wed Jan 19, 2005 3:03 pm     display tooltip text for option tag Reply with quote

hi all

i just want to know how to present a tooltip in option tag.i used title attribute but it doesn't work.i am having IE.my idea is to restrict the size of the select box and to show the option value in a tooltip when the user moves on the particular option.This will be useful if the message exceeds the size the user can still read the full message using the tooltip.i want to know why the title attribute is not working in the option tag?is there any proper convention to use the title in option??plz reply immed as iam in urgent need.
Thanks in advance to all
Corey Bryant



Joined: 15 May 2004
Posts: 8154
Location: Castle Rock CO USA

PostPosted: Wed Jan 19, 2005 3:32 pm     Reply with quote

Not too sure if I understand your question, but you might try:
Code:
<script type="text/javascript"><!--
document.write("<div id=\"ttip\" style=\"display:none;position:absolute;max-width:200px;\"><\/div>");

xBump=yBump=10;
MSIE=document.all;
NS6=document.getElementById&&!document.all;

if(MSIE||NS6){
 ttipObj=document.all?document.all["ttip"]:document.getElementById?document.getElementById("ttip"):"";
}

function MSIEBodyReturn(){
 return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;
}

function ShowTip(ttipText){
 ttipObj.innerHTML=ttipText;
 ttipObj.style.display="block";
 return false;
}

function MoveTip(e){
 xPos=(NS6)?e.pageX:event.x+MSIEBodyReturn().scrollLeft;
 yPos=(NS6)?e.pageY:event.y+MSIEBodyReturn().scrollTop;
 lEdge=(xBump<0)?xBump*(-1):-1000;
 rEdge=MSIE&&!window.opera?MSIEBodyReturn().clientWidth-event.clientX-xBump:window.innerWidth-e.clientX-xBump-20;
 bEdge=MSIE&&!window.opera?MSIEBodyReturn().clientHeight-event.clientY-yBump:window.innerHeight-e.clientY-yBump-20;
 if(rEdge<ttipObj.offsetWidth){
  ttipObj.style.left=MSIE?MSIEBodyReturn().scrollLeft+event.clientX-ttipObj.offsetWidth+"px":window.pageXOffset+e.clientX-ttipObj.offsetWidth+"px";
 }
 else if(xPos<lEdge){
  ttipObj.style.left=xBump+"px";
 }
 else{
  ttipObj.style.left=xPos+xBump+"px";
 }
 if(bEdge<ttipObj.offsetHeight){
  ttipObj.style.top=MSIE?MSIEBodyReturn().scrollTop+event.clientY-ttipObj.offsetHeight-yBump+"px":window.pageYOffset+e.clientY-ttipObj.offsetHeight-yBump+"px";
 }
 else{
  ttipObj.style.top=yPos+yBump+"px";
 }
}

function HideTip(){
 if(MSIE||NS6){
  ttipObj.style.display="none";
  ttipObj.innerText="";
 }
}


document.onmousemove=MoveTip;
//--></script>
<select name="anyname" onmouseover="ShowTip('Some HTML');" onmouseout="HideTip();">
<option value="etc">Yay!</option>
<option value="etc">Yay!</option>
<option value="etc">Yay!</option>
</select>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial