I don't know that would work, Karl. It would have to be either at the
bottom of the page, as the elements wouldn't be in the dom yet if it
was just up top. But, that did inspire an idea. If you want to keep
the compliance, you could try the following:

<head>
   <title>Test</title>
   <script type="text/javascript">
       var css = document.createElement('link');
            css.setAttribute('rel','stylesheet');
            css.setAttribute('type', 'text/css');
            css.setAttribute('href', '/path/to/css/file.css');
            document.getElementsByTagName("head")[0].appendChild(css);
   </script>
</head>
<body>
  <div id="media-gallery">
<h2>Media Gallery</h2>
<ul>
<li>
<a href="HYPERLINK"><img src="IMG SOURCE" /></a>
</li>
<li>
<a href="HYPERLINK"><img src="IMG SOURCE" /></a>
</li>
</ul>
</div>
</body>

Then, inside the CSS file you're including with javascript, put:
#media-gallery img { display: none; }

This will prevent the flickering effect, and only hide them when JS is
enabled.


function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")

}




On Apr 28, 7:26 am, Rick Faircloth <r...@whitestonemedia.com> wrote:
> >> In the <head> you can do this:
> >> <script type="text/javascript"> document.documentElement.className =
> 'js';</script>
> >> Then you can set styles for elements as descendants of .js.
>
> Karl...will you explain a little more about what this means and perhaps give
> an
> example of its implementation?  Or is there a blog or tutorial somewhere?
>
> Thanks,
>
> Rick
>
> On Mon, Apr 27, 2009 at 11:33 PM, Karl Swedberg <k...@englishrules.com>wrote:
>
>
>
>
>
> > On Apr 27, 2009, at 8:05 PM, Eric Garside wrote:
>
> > A) the images very quickly load then disapper. I dont want to hide the
> > images in css incase people have js diasbled.
>
> > You're out of luck, then. DOMReady will trigger after the images and
> > html has loaded, so unless you hide them with CSS, there's no way to
> > prevent the flash, afaik.
>
> > In the <head> you can do this:
>
> > <script type="text/javascript"> document.documentElement.className =
> > 'js';</script>
>
> > Then you can set styles for elements as descendants of .js.
>
> > --Karl
>
> --
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
> "It has been my experience that most bad government is the result of too
> much government." - Thomas Jefferson

Reply via email to