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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tooltip on Button

Status
Not open for further replies.

Lotruth

Programmer
May 2, 2001
133
US
How do you get a tooltip to appear, when you mouseover a button?
 
You can use some DHTML, but you might run into problems with that on Netscape. Here's a page that will open a small window with whatever tip you specify in the onMouseOver event handler.

You can adjust the window width, size, position to meet your needs. Load this page into your browser and try it.

Code:
<html>
<head>
<script Language=&quot;JavaScript&quot;>
<!--
var tipWin
function toolTip(tipText) {
  tipWin = window.open('','','width=200,height=50,top=100,left=100')
  wC = &quot;<html><head><title>Tips</title></head><body bgcolor='#C0C0C0'>&quot;
  wC += &quot;<table width='100%' height='100%'>&quot;
  wC += &quot;<tr><td align='middle' valign='middle'>&quot; + tipText + &quot;</td></tr></table>&quot;
  wC += &quot;</body></html>&quot;
  tipWin.document.open()
  tipWin.document.write(wC)
  tipWin.document.close()
}
function someFunc() {
  tipWin.close()
}

//-->
</script>
</head>
<body>
<form>
<input type=&quot;button&quot; onClick=&quot;someFunc();&quot; onMouseOver=&quot;toolTip('This button navigates to Yahoo')&quot; onMouseOut=&quot;javascript:tipWin.close();&quot; Value=&quot;Button&quot;>
</form>
</body>
</html>

Make sure that you close the window in the first line of whatever function is being triggered on the button click.

Hope this helps.

ToddWW :)
 
If you mean the Windows/Mac tooltip popup you just have to specify the
Code:
ALT=
parameter in an image. Most everything will also take a
Code:
TITLE=
parameter so you could also plug that in to get the tooltip. For example:
Code:
<input type=submit value=&quot;Submit&quot; title=&quot;Submit me&quot;>
 
Hey Glowball !! Why do you have to make everything so EASY !! That's not the way things are supposed to work in our professions.. LOL

Lotruth
Pay no mind to my insane scripting solution to your problem. Glowball's got the goods.. :)

ToddWW
 
HA sorry bout that, you'll have plenty of opportunities to get me back (promise)!
 
Peeshaw thanks for the surf-by! An ASP guy huh? No link in your profile?
 
No Link Huh ??

That's because we're covert, undercover, stealth, top secret, and all that James Bond stuff..

Actually, I'm an ASP in the Petroleum Industry and we provide secure applications to about 30 Tier 1 customers. Those customers service about 30-50 of their own customers and the application is branded for the Tier 1 guys. Therefore, I have to sit in the background and I don't get any of the glory while my customer's get to take all the credit !!

It's kinda nice though because we don't need a corporate presence. If they only knew we were still working out of our garage !! LOL

ToddWW
 
That sounds so... important! Would kind of be bad to be in the background all the time though, I can see what you mean. I've been pretty lucky so far *fingers crossed* and get a lot of exposure.

Don't work too hard, good to know I have to check my sarcasm now, hehh... have a good one!
 
I'm sorry Glowball and ToddWW, to interupt your discussion LOL but here is someting for Lotruth :

Take a look at these sites :



and at this page you have to look at the examples &quot;Popups&quot; and &quot;Image Map Popup&quot;. You can hardly read it, but it's the 1st row (1st and 2nd colomn)

Hope this helps,
Erik
 
Thanks A Lot. Glowball, is everything this simple?
 
Someone, somewhere, will think something is simple... most of us (myself especially included) still need our fellow programmers. Life would be boring if everything was simple!
 
Some good ideas here. How about getting a tooltip to appear when mousing over an <option> tag or a <select> element? I have the problem of a fixed sized select control where I can't view the entire text of some options. thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top