-
Notifications
You must be signed in to change notification settings - Fork 2
/
form.html
151 lines (146 loc) · 5.64 KB
/
form.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<title>Profile Card Builder</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background: linear-gradient(to right, #00d2d3, #3a7bd5);
}
.card {
width: 400px;
background: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.profile-pic {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 8px;
}
.social-icons {
display: flex;
margin-top: 20px;
}
.social-icons a {
margin-right: 10px;
text-decoration: none;
color: #333;
font-size: 20px;
}
.form-label {
font-weight: bold;
}
.form-input {
width: 90%;
padding: 10px;
margin: 5px 0;
border: 2px solid #ccc;
border-radius: 4px;
}
.form-button {
background: #00d2d3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
}
.upload-button {
display: none;
}
.upload-label {
display: inline-block;
background-color: #00d2d3;
color: white;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="card">
<h2>Profile Card Builder</h2>
<form id="profileForm">
<div>
<label class="form-label" for="photo">Upload Photo or Avatar:</label>
<input type="file" class="upload-button" id="photo" accept="image/*">
<label class="upload-label" for="photo">Choose a File</label>
</div>
<div>
<label class="form-label" for="name">Name:</label>
<input class="form-input" type="text" id="name" placeholder="Your Name" required>
</div>
<div>
<label class="form-label" for="email">Email:</label>
<input class="form-input" type="email" id="email" placeholder="youremail@example.com" required>
</div>
<div>
<label class="form-label" for="caption">Caption:</label>
<input class="form-input" type="text" id="caption" placeholder="Your Caption" required>
</div>
<div>
<label class="form-label" for="instagram">Instagram Link:</label>
<input class="form-input" type="url" id="instagram" placeholder="https://www.instagram.com/yourusername" required>
</div>
<div>
<label class="form-label" for="twitter">Twitter Link:</label>
<input class="form-input" type="url" id="twitter" placeholder="https://twitter.com/yourusername" required>
</div>
<div>
<label class="form-label" for="portfolio">Portfolio Link:</label>
<input class="form-input" type="url" id="portfolio" placeholder="https://www.yourportfolio.com" required>
</div>
<div>
<label class="form-label" for="linkedin">LinkedIn Link:</label>
<input class="form-input" type="url" id="linkedin" placeholder="https://www.linkedin.com/in/yourname" required>
</div>
<button class="form-button" type="button" id="updateCardButton">Update Card</button>
</form>
</div>
<script>
// Function to update the card content
function updateCard() {
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const caption = document.getElementById('caption').value;
const instagramLink = document.getElementById('instagram').value;
const twitterLink = document.getElementById('twitter').value;
const portfolioLink = document.getElementById('portfolio').value;
const linkedinLink = document.getElementById('linkedin').value;
// Update the card content
document.getElementById('name').textContent = name;
document.getElementById('email').textContent = email;
document.getElementById('caption').textContent = caption;
document.getElementById('instagramLink').href = instagramLink;
document.getElementById('twitterLink').href = twitterLink;
document.getElementById('portfolioLink').href = portfolioLink;
document.getElementById('linkedinLink').href = linkedinLink;
}
// Initialize the file input and show the selected file name
const uploadInput = document.getElementById('photo');
const uploadLabel = document.querySelector('.upload-label');
uploadInput.addEventListener('change', function () {
if (uploadInput.files.length > 0) {
uploadLabel.textContent = uploadInput.files[0].name;
} else {
uploadLabel.textContent = 'Choose a File';
}
});
// Initial update
updateCard();
// Update card when the button is clicked
const updateCardButton = document.getElementById('updateCardButton');
updateCardButton.addEventListener('click', updateCard);
</script>
</body>
</html>