HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 24th, 2005, 12:40 PM
Discusman Discusman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 346 Discusman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 12 sec
Reputation Power: 0
Provide Description of an item on page when mouse pointer on

how can I do this?

Let's say when I move my mouse pointer to an image or a hyperlink. It should pop up a note that displays the description of that image or that hyperlink.

<A href="http://www.mywebsite/test.asp">
<img src="http://www.mywebsite/nose.jpg"></a>

Where do I put that function in???
__________________
If you have discus home and like to share your expertize with others. Please join us at NYC-DiscusFanatics.com. NYC-DiscusFanatics.com is a helpful discus website based in NYC. It consists of forums, gallery, discus breeder central and search engines, etc.

Reply With Quote
  #2  
Old February 24th, 2005, 12:44 PM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2004
Posts: 2,944 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 10 h 43 m 32 sec
Reputation Power: 98
This would include dHTML and response to the onMouseOver and onMouseOut events. As these are pure HTML/dHTML/JavaScript issues, I'm moving this thread to the correct forum
__________________
selwonk

If I've posted some code above, you might think it looks a bit simplistic. It might be. I'd rather people tried the next step themselves rather than getting a full solution on a plate. That way they learn more!

Reply With Quote
  #3  
Old February 24th, 2005, 01:24 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
you can also use the title and alt attributes:
Code:
 <a href="http://www.mywebsite.com/test.asp" title="my description">
 	 <img src="http://www.mywebsite.com/nose.jpg" alt="my alt text" />
 </a>
 

FYI - you should also use width and height in the <img> element

Reply With Quote
  #4  
Old February 24th, 2005, 01:54 PM
Discusman Discusman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 346 Discusman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 12 sec
Reputation Power: 0
yeah, I forgot to put the img size in the tag here.

What is alt text?

Reply With Quote
  #5  
Old February 24th, 2005, 03:43 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
alt is an attribute of the <img ... /> element. It is supposed to be used as a replacement for the image for people who can't see and are using a text reader for their web browser. IE does renders alt as a tool tip when you hover the mouse over an image. Most other browsers render the title attribute of the <a> element as a tool tip. Does that make sense?
Comments on this post
Shadow Wizard agrees: make sense indeed!

Reply With Quote
  #6  
Old February 24th, 2005, 08:18 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,628 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 23 m 57 sec
Reputation Power: 1902
the code you need is like this, as banker said:
Code:
  <a href="<%=rs("URL")%>" title="<%=rs("Descriptipn")%>">
  <img src="<%=rs("image")" /></a>
 

assuming all the data is coming from database.
if the image is the link, the title would appear as tooltip when the mouse will be over it in all modern browsers.

Reply With Quote
  #7  
Old February 24th, 2005, 10:49 PM
Discusman Discusman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 346 Discusman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 12 sec
Reputation Power: 0
Thanks guys. Make sense to me..

Reply With Quote
  #8  
Old February 25th, 2005, 02:08 PM
Phoenix's Avatar
Phoenix Phoenix is offline
Web-Standards Evangelist
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Posts: 1,522 Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 48 m 4 sec
Reputation Power: 8
Apathy! Ignorance! FrontPage! By your powers combined! I am WebStandardsMan!

o/~ WebStandardsMan, he's a hero! Gonna take Internet Explorer down to zero! He's the W3C... personified and he's fighting for the standards side!

I'm a WSG member! You can be one too! 'cause writing semantic code is the thing we do! FrontPage and HTML4.01 Transitional is not the way! Here's what WebStandardsMan has to say!

The power to write semantic code is YOURS! o/~

</Blatent Captain-Planet Rip>

Anyway....

IRT the whole thread:

The XHTML1.0 spec (well, the HTML4 spec started it off) is pretty clear that the global element attribute "title" is to be used for all extraneous information, it recommends that visual UAs render them as tooltips.

Therefore, got an image and want to give it a tooltip? Use
Code:
<img src="#" title="Hello" />


Likewise, you can give your whole document a tooltip:

Code:
<body title="Hello!" xml:lang="en">


As I said, its a global attribute, so you can use it on ANY element (or as evil do'ers call them... "tags")

However! There is a limitation, unfortunatley. You cannot have linebreaks in tooltips (Well, you can, but it isn't recommended as rendering accross platforms is inconsistent)

Instead, use of ECMAScript w/ W3C DOM Level 1 is recommended. Create a division element (<div>) and fill it with your "popup" content and use the universal onMouseOver event to display (display: block; ) and position (position: absolute; )

Well, that's my work here done!

Remember kids! The power to write semantic, standard, and accessible code is YOURS!

*disolves into the ground*

Reply With Quote
  #9  
Old February 25th, 2005, 09:49 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,628 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 23 m 57 sec
Reputation Power: 1902
LOL
that was quite a show!! made my night!

Reply With Quote
  #10  
Old February 25th, 2005, 10:20 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Quote:
Instead, use of ECMAScript w/ W3C DOM Level 1 is recommended. Create a division element (<div>) and fill it with your "popup" content and use the universal onMouseOver event to display (display: block; ) and position (position: absolute; )

I'd be interested in a tutorial on this, do you know where I could find one?

Reply With Quote
  #11  
Old February 26th, 2005, 09:50 AM
Phoenix's Avatar
Phoenix Phoenix is offline
Web-Standards Evangelist
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Posts: 1,522 Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 48 m 4 sec
Reputation Power: 8
Here's the XHTML, get ShadowWizard to give you the ECMAScript w/ W3C DOM:

XHTML

Code:
 <img id="imgX" src="images/someimage.png" alt="A picture containing randomness" title="" />
 
 <div id="imgXextra" class="extrainfo">
 	<p>Put all your extra info here</p>
 </div>
 


(where "X" is some unique number shared between the two elements)

CSS

Code:
 img { border: none; }
 .extrainfo { display: none; }
 
 .extrainfovisible { display: block; position: absolute; border: 1px solid black; background: white; }
 


ECMAScript (may be buggy, get SW to go over it)

Code:
 <somecode to detect mouseover on id="img" + X + "" elements.>
 	.onmouseover = function {
 	imgX.classname = "extrainfovisible";
 	imgX.style.top = mouseY(); // I don't know the DOM well, but I'm guessing that there's some way to getting the current mouse position
 	imgX.style.left = mouseX();
 }
 


....Something like that

Oh, and note the semantic classnames, "tooltip" is more platform specific than "extrainfo", which is what it is. Rather than "tooltip" which is how you intend it to be displayed.

Reply With Quote
  #12  
Old February 26th, 2005, 10:20 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,628 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1Folding Points: 372965 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 23 m 57 sec
Reputation Power: 1902
yes the logic is correct, as for the code... well, it's not so simple. first, you have to use two events: mouseover to show the details and mouseout for hiding them. and badly enough, to get mouse position you have different code for IE and for Firefox... I've solved all this and using something that is cross browser, it's in my office so I'll take a look tomorrow and post it here.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Provide Description of an item on page when mouse pointer on


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On