Image Captions | JavaScriptSource

Image Captions

Dunstan Orchard Dec 29, 2006

General

This script uses the text from the title attribute of an image as a caption for the image. If your title attribute contains a URL then the caption becomes a link, otherwise it's presented as plain text.


Example 1: Plain text caption, style 1

You really need to get Firefox

Example 2: Plain text caption, style 2

You really need to get Firefox

Example 3: URL caption

You really need to get Firefox

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: extractImageTitles.js


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(2 comments)

Nice script to have in our work. Being a web developer its very useful for me.[br /]One suggestion is that, can make the image enlargeable when clicked. If added with the script it will be more useful and fine.[br /][br /]Thanks for giving me a opportunity to write to your site.

Yuvaraj Aug 23, 2007

Incredible!

Watch TV Online Jan 2, 2007