-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
68 lines (62 loc) · 3.36 KB
/
index.html
File metadata and controls
68 lines (62 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="ms">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kad Nama Digital</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<style>
body { font-family: Arial, sans-serif; text-align: center; background-color: #e3f2fd; padding: 20px; }
.container { max-width: 500px; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2); margin: auto; }
input { width: 90%; padding: 10px; margin: 5px 0; border: 2px solid #007BFF; border-radius: 5px; font-size: 16px; }
button { padding: 10px 20px; margin: 10px; cursor: pointer; background-color: #007BFF; color: white; border: none; border-radius: 5px; font-size: 18px; }
button:hover { background-color: #0056b3; }
#card { display: none; background: #ffffff; padding: 20px; border-radius: 10px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); margin-top: 20px; }
#card h2 { font-size: 22px; color: #007BFF; }
#card h3, #card p { margin: 10px 0; padding: 10px; border-radius: 5px; background: #f1f8ff; border-left: 5px solid #007BFF; text-align: left; }
#qrcode { margin-top: 20px; }
footer { margin-top: 20px; font-size: 14px; color: #444; font-weight: bold; }
</style>
</head>
<body>
<div class="container">
<h2>Kad Nama Digital</h2>
<input type="text" id="name" placeholder="Nama Penuh">
<input type="text" id="phone" placeholder="Nombor Telefon">
<input type="email" id="email" placeholder="Email">
<input type="url" id="website" placeholder="Laman Web (Opsyenal)">
<button onclick="generateQRCode()">Jana Kad Nama & QR Code</button>
<div id="card">
<h2>Digital Detail</h2>
<h3 id="cardName"></h3>
<p id="cardPhone"></p>
<p id="cardEmail"></p>
<p id="cardWebsite"></p>
<div id="qrcode"></div>
</div>
</div>
<footer>
©2025 Mr.Syah
</footer>
<script>
function generateQRCode() {
let name = document.getElementById("name").value;
let phone = document.getElementById("phone").value;
let email = document.getElementById("email").value;
let website = document.getElementById("website").value;
if (!name || !phone || !email) {
alert("Sila isi semua maklumat yang diperlukan!");
return;
}
let contactInfo = `Digital Detail\nNama: ${name}\nNo Telefon: ${phone}\nEmail: ${email}\nLaman Web: ${website ? website : "Tiada"}`;
document.getElementById("card").style.display = "block";
document.getElementById("cardName").innerText = "Nama: " + name;
document.getElementById("cardPhone").innerText = "No Telefon: " + phone;
document.getElementById("cardEmail").innerText = "Email: " + email;
document.getElementById("cardWebsite").innerText = website ? "Laman Web: " + website : "";
document.getElementById("qrcode").innerHTML = "";
new QRCode(document.getElementById("qrcode"), contactInfo);
}
</script>
</body>
</html>