Last active
March 8, 2016 13:14
-
-
Save fabwu/63c0d8e8e15975e9085b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Basic HTML und CSS Manipulation</title> | |
</head> | |
<body> | |
<h1>Basic HTML und CSS Manipulation</h1> | |
<p>Erzeugen Sie eine einfache Webseite in HTML die einen oder mehrere Texte und einen Button enthält. Verändern Sie den | |
Inhalt oder Aussehen der Webseite, wie folgt:</p> | |
<p id="fade">FADE OUT...</p> | |
<ol> | |
<li>Verändern Sie den Text.</li> | |
<li>Verändern Sie den Hintergrund des Texts</li> | |
<li>Verändern Sie den Hintergrund des Texts, sodass bei jedem drücken eines Buttons eine zufällige Farbe gesetzt | |
wird. | |
</li> | |
<li>Old Style Animation: Erzeugen Sie eine JavaScript Funktion, die ein Element verblassen lässt, i.e. es wird | |
langsam unsichtbar. Wenden Sie diese auf den Text an. | |
</li> | |
</ol> | |
<button>Test</button> | |
<script> | |
window.addEventListener('load', function () { | |
var p = document.getElementsByTagName('p')[0]; | |
p.textContent = 'Hurra!'; | |
p.style.backgroundColor = '#F2F2F2'; | |
var button = document.getElementsByTagName('button')[0]; | |
button.addEventListener('click', function () { | |
p.style.backgroundColor = '#' + Math.floor(Math.random() * 16777215).toString(16); | |
}); | |
var fade = document.getElementById('fade'); | |
fade.style.opacity = 1.0; | |
setInterval(function () { | |
fade.style.opacity -= 0.1; | |
}, 500); | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment