50 lines
1.6 KiB
HTML
50 lines
1.6 KiB
HTML
<!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> |