Switch by Day even/odd

A

Arenas

Mitglied
Guten Tag,

Bitte können Sie den Stuff in Ordnung bringen?
Ich habe keine Fehlermeldung.
Aber die Apostrofen oder Beistriche sind nicht richtige eingesetzt worden !?! :(

Mit css habe ich kein Problem als Einfach. [Win 10, Edge, Mobile (iPhone)]
Code:
CSS:
html {
width: 1400; height: auto; float:left;
background: -webkit-radial-gradient(0% 0%, circle cover, #0000ff 0%, #ffffFF 50%, #ff0000 100%);
background: -moz-radial-gradient(0% 0%, circle cover, #0000ff 0%, #ffffFF 50%, #ff0000 100%);
background: -ms-radial-gradient(0% 0%, circle cover, #0000ff 0%, #ffffFF 50%, #ff0000 100%);
background: -o-radial-gradient(0% 0%, circle cover, #0000ff 0%, #ffffFF 50%, #ff0000 100%);
background: radial-gradient(at top left, #0000ff, #ffffff, #ff0000);}
Link:

Table-OneDrive

Danke

Arnold

Switch by Day even/odd:

Javascript:
Javascript:
<script>
var today = new Date();
var dayStr = String(today.getDate()).padStart(2, '0');
var day = parseInt(dayStr);

if(day % 2 == 0)
{
document.getElementById("OddEven").body.style.backgroundImage = '
height:100%; width:100%;
background: -webkit-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%)
background: -moz-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%)
background: -ms-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%)
background: -o-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%)
background: radial-gradient(at top left, #0005bbb, #ffd500)';
}
else
{
document.getElementById("OddEven").body.style.backgroundImage = '
height:100%; width:100%
background: -webkit-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%)
background: -moz-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%)
background: -ms-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%)
background: -o-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%)
background: radial-gradient(at top left, #084b8a, #000000, #ffffff)';
}
</script>
 
Zuletzt bearbeitet von einem Moderator:
T

thecain

Top Contributor
Nebst der Fehlermeldung meiner Augen, beim Anschauen der Seite sehe ich auch eine in der Console von meine Chrome:

Uncaught SyntaxError: Invalid or unexpected token: Table-OneDrive.html:69

Javascript:
if (str == ") return false;

Auch dein HTML Code hat viele Fehler

Abgesehen von all dem, sehe ich nicht, wie der Teil Code den du gepostest hast funktionieren soll. Da ist kaum etwas richtig
 
A

Arenas

Mitglied
Das ist das Resultat was ich brauche:

Danke,
Arnold

So mit wäre das probleme gelöst! :)
===============================================
Der html Scripte mit javascript
Code:
<!DOCTYPE html>

    <html>
    
        <head>
            <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
            <title>background color 1</title>
            
                <style>
                    html {width:100%; height: 100%;}
                    .day-even {
                        background: -webkit-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%);
                        background: -moz-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%);
                        background: -ms-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%);
                        background: -o-radial-gradient(0% 0%, circle cover, #005bbb 0%, #ffd500 100%);
                        background: radial-gradient(at top left, #0005bbb, #ffd500);}
                    
                    .day-odd {
                        background: -webkit-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%);
                        background: -moz-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%);
                        background: -ms-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%);
                        background: -o-radial-gradient(0% 0%, circle cover, #084b8a 0%, #000000 50%, #ffffff 100%);
                        background: radial-gradient(at top left, #084b8a, #000000, #ffffff);}
                </style>
            
            <script>
                  const today = new Date().getDate();
                  document.body.className = ['day-even', 'day-odd'][today % 2]
            </script>
        
        </head>
    <body class="day-even, day-odd">
    
    </body>
    
</html>
 
Anzeige

Neue Themen


Oben