[thelist] Stylesheet switching Jitters

Hassan Schroeder hassan at webtuitive.com
Tue Mar 8 11:06:27 CST 2005


Sam Carter wrote:
> Again, no luck, even coding the windows.onload event as text in the 
> header.  It's a very tight order:

> <script type="text/javascript">
> window.onload = function(e) {
>  var cookie = readCookie("style");
>  var title = cookie ? cookie : getPreferredStyleSheet();
>  setActiveStyleSheet(title);
>  setGraphics(true);
> }

> Is there any other way to get the onload event processed before the page 
> is rendered in white?

If your functions aren't referencing anything in the document, why
wait for "onload"? {WAG/untested!} why not try running this inline?

<script type="text/javascript">
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
setGraphics(true);
</script>

FWIW!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list