Posted By

Corhol on 08/16/06


Tagged

javascript images


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

meth
aurele
Hirmine
vali29


Dynamic Image Titles


 / Published in: JavaScript
 

  1. // if an image is missing a title attribute,
  2. // adds title based on the alt attribute of the image
  3. for ( i = 0; i < document.images.length; i++ ) {
  4. if ( document.images[i].title == "" && document.images[i].alt != "" )
  5. document.images[i].title = document.images[i].alt;
  6. }

Report this snippet  

You need to login to post a comment.