Javascript ITL 23092026

This commit is contained in:
2026-09-23 11:16:37 +02:00
parent 3b7d2349da
commit 72a94ecde8
4 changed files with 133 additions and 1 deletions
+7
View File
@@ -33,6 +33,11 @@
var myVariable = 1;
let myVariable = 1;
snake_case --> number_of_snakes
Kebab-case --> number-of-kebabs
camelCase --> firstNumber
PascalCase -->
*/
@@ -42,6 +47,8 @@
firstNumber = "kickboxen";
console.log(firstNumber);
</script>
</body>
</html>
+50
View File
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Second Javascript</title>
<link rel="stylesheet" href="assets/css/02.css">
</head>
<body>
<div class="container">
<h2>Login</h2>
<label for="username">Benutzername</label>
<input type="text" name="userName" id="username" placeholder="Jonny">
<br><br>
<label for="password">Passwort</label>
<input type="password" id="togglePasswordBtn" name="passWord" placeholder="Password"><br><br>
<button id="togglePasswordBtn" onclick="togglePassword()">Passwort anzeigen/ausblenden</button><br>
<button id="togglePasswordBtn2">Passwort anzeigen/ausblenden</button>
</div>
<script>
function togglePassword(){
var passwordField = document.getElementById("togglePasswordBtn");
if(passwordField.type === 'password'){
passwordField.type = 'text';
}
else if(passwordField.type === 'text'){
passwordField.type = 'password';
}
}
document.getElementById('togglePasswordBtn2').addEventListener('click', function() {
var passwordField2 = document.getElementById("togglePasswordBtn");
if(passwordField2.type === 'password'){
passwordField2.type = 'text';
}
else if(passwordField2.type === 'text'){
passwordField2.type = 'password';
}
});
</script>
</body>
</html>
+34
View File
@@ -0,0 +1,34 @@
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.container {
max-width: 300px;
margin: auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
width: 100%;
padding: 10px;
margin: 8px ;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}