Langsung ke konten utama

code login

CONTOH CODE LOGIN HTML  <!DOCTYPE html> <html lang="id"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Login</title>     <style>         body {             font-family: Arial, sans-serif;             text-align: center;             margin: 50px;         }         .login-container {             max-width: 300px;             margin: auto;             padding: 20px;             border: 1px solid #ccc;             border-radius: 5px;         }         input {          ...

code login

CONTOH CODE LOGIN HTML






 <!DOCTYPE html>

<html lang="id">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Login</title>

    <style>

        body {

            font-family: Arial, sans-serif;

            text-align: center;

            margin: 50px;

        }

        .login-container {

            max-width: 300px;

            margin: auto;

            padding: 20px;

            border: 1px solid #ccc;

            border-radius: 5px;

        }

        input {

            width: 100%;

            padding: 10px;

            margin: 5px 0;

        }

        button {

            padding: 10px;

            width: 100%;

            background-color: blue;

            color: white;

            border: none;

            cursor: pointer;

        }

    </style>

</head>

<body>


<div class="login-container">

    <h2>Login</h2>

    <form id="loginForm">

        <input type="text" id="username" placeholder="Nama Pengguna" required>

        <input type="password" id="password" placeholder="Kata Sandi" required>

        <button type="button" onclick="login()">Masuk</button>

    </form>

    <p id="message"></p>

</div>


<script>

    function login() {

        var username = document.getElementById("username").value;

        var password = document.getElementById("password").value;


        if (username === "admin" && password === "1234") {

            document.getElementById("message").innerText = "Login berhasil!";

            document.getElementById("message").style.color = "green";

        } else {

            document.getElementById("message").innerText = "Login gagal!";

            document.getElementById("message").style.color = "red";

        }

    }

</script>


</body>

</html>



Postingan populer dari blog ini

GAMBAR

 

PHOTO