gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
Build a landing page with full name, phone number and gender with HTML, CSS Javascript
- User
Build a landing page with full name, phone number and gender with HTML, CSS Javascript
- Assistant
Build a landing page with full name, phone number and gender with HTML, CSS Javascript
To build a landing page with a full name, phone number, and gender using HTML, CSS, and JavaScript, you can follow the steps below:
<!DOCTYPE html>
<html>
<head>
<title>Landing Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<h1>Sign up</h1>
<form id="signup-form">
<label for="full-name">Full Name</label>
<input type="text" id="full-name" required>
<label for="phone-number">Phone Number</label>
<input type="text" id="phone-number" required>
<label for="gender">Gender</label>
<select id="gender" required>
<option value="">Select gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
<button type="submit">Submit</button>
</form>
</div>
<script src="script.js"></script>
</body>
</html>
.container {
max-width: 480px;
margin: 0 auto;
padding: 40px;
}
h1 {
text-align: center;
}
form label {
display: block;
margin-top: 20px;
}
form input, form select {
width: 100%;
padding: 10px;
margin-top: 5px;
}
form button {
width: 100%;
padding: 10px;
margin-top: 20px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
form button:hover {
background-color: #45a049;
}
document.getElementById('signup-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent form submission
// Get form field values
var fullName = document.getElementById('full-name').value;
var phoneNumber = document.getElementById('phone-number').value;
var gender = document.getElementById('gender').value;
// Print the values to the console for testing
console.log('Full Name: ' + fullName);
console.log('Phone Number: ' + phoneNumber);
console.log('Gender: ' + gender);
// Clear form fields
document.getElementById('full-name').value = '';
document.getElementById('phone-number').value = '';
document.getElementById('gender').value = '';
// Show success message or perform additional actions
});
That's it! You now have a basic landing page with a form for users to enter their full name, phone number, and gender. When the form is submitted, the JavaScript code will retrieve the field values and display them in the console. You can modify the JavaScript code to perform other actions such as displaying a success message or sending the form data to a server.
Not yet included in a published release.