faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 32 people (56%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Can I get tooltip without any event handling (not on links)?

Apr 5th, 2008 19:21
ha mo, sven vahar, Colin Fraser, Suchit Jain,


Up till now there is no viable alternative to generating an event to get 
an action on the page. In this case you have to use a link, but you can 
make it do nothing.  
 <SCRIPT LANGUAGE="JavaScript"><!--
 function doNothing() {}
 //--></script>
<A HREF="javascript:doNothing()" onMouseOver="make tip div visible" 
onMouseOut="make tip div invisible">whatever</a>
Of course, this is a very clumsy way of reinventing the wheel. If you 
are using images then all you need do is use HTML, for example
<img src="../images/wheel.gif" alt="Click here to put wheel on cart">
<img src="../images/flat.gif" alt="This is a flat tyre on the car">
But then your initial question is somewhat vague.
-------------------------
Just add title attribute to desired element.
Like: <h1 title="foo boo hoo">FBH</h1>. Can be applied to any element.
Any HTML 4.0 compatible browser should be able to display it (in
theory).
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com