Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create tooltip for listbox?

Status
Not open for further replies.

passs

Programmer
Dec 29, 2003
170
0
0
RU
Hello everybody!

Does somebody know how to create ToolTip for list box or for dropdownlist?

I'll be very thankful for any help or ideas!
Thanks.
Best regards,
Alex
 
<select title="Tool tip"...


works only in IE

Known is handfull, Unknown is worldfull
 
Hey, no, actually I need a tooltips not for whole listbox, for its items, for example I click on first item and see its name in tooltip in full form not cuted by listbox width property. That's what I mean.
Thank anyway.
Alex
 
well, u need to use layers in that case, the coding might be really huge, i can just give u an idea:
<div style="position:absolute;left10px;top:15px;visibility:hidden" id='DivTg'></div>
<select ..... onclick="ShowToolTip(this.value)">



<script>
function ShowToolTip(TheValue)
{
document.getElementById('DivTg').innerText=TheValue
document.getElementById('DivTg').style.visibility="visible"

}
</script>

Known is handfull, Unknown is worldfull
 
Thanks for this idea, hope I'll be able to realize it in my code, thank you!

Best regards,
Alex
 

Try searching for "ToolTip select lists dyn-web" on Google. I haven't look at any of the code but they appear to have looked into your problem.
 
Hey guys!
Look how have I made it:
function ToolTips(name){
var oObj;
oObj = new ActiveXObject("Internet.HHCtrl");
lb = document.getElementById(name);
ind = lb.selectedIndex;
ss = lb.options[ind];
if (ss.text.length>15)
{
if(ind >= 0){
oP = lb.options[ind];
oObj.TextPopup(oP.text,"Times New Roman,8",5,3,-1,0);
}
}
}
and that is working:)

Thank you all!
Best regards
Alex
 
Do you have a simple example of how you've used this in a form? Thanks.
 
yes sure:
<script....
function ToolTips(name){
var oObj;
oObj = new ActiveXObject("Internet.HHCtrl");
lb = document.getElementById(name);
ind = lb.selectedIndex;
ss = lb.options[ind];
if (ss.text.length>15)
{
if(ind >= 0){
oP = lb.options[ind];
oObj.TextPopup(oP.text,"Times New Roman,8",5,3,-1,0);
}
}
}
</script>

<form id=Form1>
<select id="mySelect" onClick="ToolTips(mySelect)">
<option>...</option>
...
...
</form>

so now it will show tooltip for options with length more then 15 symbols. Works in Windows only:)

Best reagrds
Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top