Tim Wolf wrote:
>I realize this is a bit of a scripting issue, but I'm seeking a solution from
>the CSS community as it regards a fundamental style change and a desire to
>validate in XHTML.
>
>I am trying to create a page with a body background image that will randomly
>change when the page is reloaded. After seeking out numerous solutions, I
>settled on one that works using Javascript to change the image style within
>the body tag of my document.
>
>http://www.liquidterrain.com/index.html
>
>This doesn't validate as XHTML largely because the <body> tag is wrapped
>within the implemented <script>. I imagine this would also break the entire
>page if the client's Javascript was turned off.
>
>
Hi Tim,
No, in Firefox and Opera it's easy to turn off js, and the page is not
broken, only showing a beautiful white background. :-)
>Is anyone aware of a method to randomly change the <body> style, perhaps by
>randomly loading a different style sheet?
>
>Thanks.
>
For this,
1. I should take a normal <body>
2. In the body {...} css you define a default background image for in
case js is disabled.
3. In the html, immediately after the <body>, you can add by script a
new <div>: document.write('<div style="background: .../ the
turning round machine /...">')
4. Then normal html follows.
5. Just before </body> you close the extra </div> by script again.
What is opened in script, now is closed in script too. And if script
disabled, both are ignored: balance is there! :-) .
I think this way it must be validating. [1]
Greetings,
francky
[1] Technically! @ some of the actual random backgrounds the text is not
good readable or not at all readable: because of colors and/or structure
of the img. So for me the white background at disabled javascript
doesn't seem too bad at all! And the other way round: the images deserve
more as text crossing over it. - But this is a personal view... ;-)
______________________________________________________________________
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/