code from 30-04-26
This commit is contained in:
27
Zweites Jahr/javascript/dropdown.html
Normal file
27
Zweites Jahr/javascript/dropdown.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dropdown Menü</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Elektronischer Wahlzettel, der Landtagswahl in BA-WÜ</h1>
|
||||
|
||||
<form>
|
||||
<select name="partei" id="auswahl">
|
||||
<option value="Andreas Stoch"> SPD </option>
|
||||
<option value="Manuel Hagel"> CDU </option>
|
||||
<option value="Cem Özdemir"> B: 90 / Die Grünen </option>
|
||||
<option value="Hans-Ulrich Rülke"> FDP </option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
document.getElementById("auswahl").addEventListener("change", function() {
|
||||
let value = this.value;
|
||||
alert("Du hast gewählt: " + value);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
28
Zweites Jahr/javascript/eventlistener.html
Normal file
28
Zweites Jahr/javascript/eventlistener.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>EventListener</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>EventListener</h1>
|
||||
<button id="myBtn">Try it</button>
|
||||
<button id="myBtn2">Click erst um 13:45 Uhr drauf!</button>
|
||||
|
||||
<script>
|
||||
// Normaler Funktionsaufruf nach Button click
|
||||
document.getElementById("myBtn").addEventListener("click", myFunc);
|
||||
|
||||
function myFunc(){
|
||||
alert("Button clicked!");
|
||||
}
|
||||
|
||||
// Anonyme Funktion nach Button click
|
||||
document.getElementById("myBtn2").addEventListener("click", function(){
|
||||
alert("Schule aus!")
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user