I'm using some Javascript to display a "photo fade rotator" in a <div>
. If JS is not enabled, however, I've got an animated gif I want to display instead. I actually have it working with this code:
<div id="slideshow" class="show pics float-left">
<img src="images/banner-photos/new-01.png" width="343" height="228" alt="photo" />
<img src="images/banner-photos/new-02.png" width="343" height="228" alt="photo" />
<img src="images/banner-photos/new-03.png" width="343" height="228" alt="photo" />
</div>
<noscript>
<link href="css/hide-slideshow.css" rel="stylesheet" type="text/css" />
<p class="adjust"><img src="images/banner-photos/animation.gif" alt="slideshow" /></p>
</noscript>
External JS files do their magic on the <div>
. The classes on id="slideshow" set dimensions, padding, margin, positioning, etc. The "hide-slideshow" css file does a "display:none" on #slideshow, and the "adjust" class around the animated gif does some pushing and pulling to get it where it needs to be (which is where the slideshow would be if it wasn't hidden).
I've tested this in FF3, IE7, IE8, Chrome, and Safari (Win). The good news is that it works like a charm. The bad news is that it doesn't pass the W3C validator. I get an error that says, "document type does not allow element "link" here".
Even though my method works, is it too kludgey? Is there a better way to show one <div>
if JS is enabled and a different <div>
if it's not, in a way that works cross-browser and passes the validation?
Thanks!