Editing JavaScript 1 Document Objekt
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 208: | Line 208: | ||
</form> | </form> | ||
<script> | <script> | ||
// Möglichkeit 1 um entsprechendes Optionsfeld auszuwählen | // Möglichkeit 1 um entsprechendes Optionsfeld auszuwählen | ||
selection-list.selectedIndex = 2; | |||
// Möglichkeit 2 | // Möglichkeit 2 | ||
selection-list.options[2].selected = true; | |||
// Möglichkeit 3 | // Möglichkeit 3 | ||
selection-list.value = "selection3"; | |||
</script> | </script> | ||
</body> | </body> | ||
Line 250: | Line 249: | ||
* Wenn Fokus entfernt wird, kommt es zum blur-Event | * Wenn Fokus entfernt wird, kommt es zum blur-Event | ||
*/ | */ | ||
field1.onfocus = message; | |||
</script> | </script> | ||
</body> | </body> | ||
Line 279: | Line 278: | ||
* tritt die Fehlermeldung auf | * tritt die Fehlermeldung auf | ||
*/ | */ | ||
field1.onblur = message; | |||
</script> | </script> | ||
</body> | </body> | ||
Line 468: | Line 467: | ||
for (let value of arr) { | for (let value of arr) { | ||
content += value[0] + ": " + value[1] + "<br>"; | content += value[0] + ": " + value[1] + "<br>"; | ||
} | } | ||
// decodeURIComponent wird benötigt um | |||
// zb das @ Zeichen richtig darzustellen | |||
document.getElementById("paragraph").innerHTML = content; | document.getElementById("paragraph").innerHTML = content; | ||
</script> | </script> | ||
Line 488: | Line 489: | ||
"use strict"; | "use strict"; | ||
function | function tauschen() { | ||
document.images[0].src = "bild2.jpg"; | document.images[0].src = "bild2.jpg"; | ||
} | } | ||
btn.onclick = | btn.onclick = tauschen; | ||
</script> | </script> | ||
</body> | </body> | ||
Line 502: | Line 503: | ||
<body> | <body> | ||
<div id="div"> | <div id="div"> | ||
<p id=" | <p id="absatz">Hier steht ein Absatz</p> | ||
</div> | </div> | ||
<button type="button" onclick=" | <button type="button" onclick="hintergrund()">Layout verändern</button> | ||
<script> | <script> | ||
function | function hintergrund() { | ||
document.getElementById(" | document.getElementById("absatz").style.background = "red"; | ||
document.getElementById(" | document.getElementById("absatz").style.fontSize = "30px"; | ||
document.getElementById(" | document.getElementById("absatz").style.color = "white"; | ||
document.getElementById(" | document.getElementById("absatz").style.width = "150px"; | ||
document.getElementById(" | document.getElementById("absatz").style.border = "3px solid blue"; | ||
} | } | ||
</script> | </script> | ||
</body> | </body> | ||
</pre> | </pre> | ||
<blockquote> | |||
Quelle: JavaScript | |||
Programmieren für Einsteiger | |||
ISBN: 978-3-96645-016-4 | |||
</blockquote> |