Displaying text about images

They have: 2 posts

Joined: Mar 2006

Confused Im designing a webpage which primarily displays my artwork. I have all of my images set up in a table the way I want them and the links work to open up the full sized picture. What I would like to do is display a paragraph about the artwork somewhere on the page either when someone hovers over an image or clicks on an image. I've tried using the onClick and onMouseover functions of javascript, but I can only get it to display text in a brand new window. Is there any way to get it to display this text on the same page???

demonhale's picture

He has: 3,278 posts

Joined: May 2005

a simple solution to this is use something like this on your alt tag for your a href command...

like so:
or

The Alt tag will display on mouse-over, and is also helpful to your SEO...
alternately images without links can also use the "alt" tag...

An advanced solution is either to use DHTML or javascript...

DaveyBoy's picture

They have: 453 posts

Joined: Feb 2003

Well Firefox won't show your ALT tags on mouseover, will it?

They have: 2 posts

Joined: Mar 2006

well I know about the alt tag, but that isnt what I had in mind, Im sure I probably need DHTML or javascript for it. One thing I thought about, I can make a paragraph and use css to set it to display:none; , is there a way to trigger it to make my text display only after someone hovers over the image or clicks on it?

demonhale's picture

He has: 3,278 posts

Joined: May 2005

it could be done, but would require scripting too, by the way davey, alt tags show on FF...

Why not check out dynamicdrive.com , functional DHTML i guess will really work for this...

I was thinking AJAX, but its pretty advanced...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Alt text won't display in Firefox no matter how long you hover over it, you will next the title attribute for that.

Alternately, try going to javascriptkit.com and see if you can find a script that will suit your needs.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

My bad, I usually put alt tags with my title tags, so it does work similarly...

Busy's picture

He has: 6,151 posts

Joined: May 2001

alt tags are for displaying before and if the image doesn't load
the title attribute (title="description") will display a small tool tip on whatever it is used on, can be used on the body tag (not recommended), links, images, ....

javscript tooltips can be used but they are slow, annoying, wont work if javascript disabled and not all of the scripts work in all browsers.
Ideally a CSS tool tip is the best solution.
lots to choose from, here is a sample of results

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.