Shelly,

Design Groups schreef:
> What I want to do is display the alt text for my images, instead of the 
> images themselves, in the printed page.  I don't want any images to 
> print out at all - just the text.
Interesting problem. Have you considered image replacement? If you want 
it to be pure CSS, you'd have to create a seperate class for every 
image, but using Javascript you don't have to.

E.g. (CSS):
<span class="image1">ALT for Image 1</span>
<span class="image2">ALT for Image 2</span>

<style>
@media all {
    .image1 { /* image replacement for Image 1 */ }
    .image2 { /* image replacement for Image 2 */ }
}
@media print {
    .image1 { /* undo image replacement for Image 1 */ }
    .image2 { /* undo image replacement for Image 2 */ }
}
</style>

E.g. (CSS + JS):
<span class="image" rel="image1.jpg">ALT for Image 1</span>
<span class="image" rel="image2.jpg">ALT for Image 2</span>

<style>
.replacedImage { /* image replacement without actual image source */ }
</style>

<script>
    /* WINDOW.ONLOAD */
    // 1: get all spans with class "image" (using getElementsByClassName 
[1])
    // 2: find the image source in the rel attribute of the spans you 
just found in step 1 (or in whatever other attribute you put them)
    // 3: set the className of the span to replacedImage
    // 4: add the image source in a style attribute to finish the image 
replacement
</script>

That should do the trick.

HTH,
Rick

[1]: 
http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to