Here is an example of an HTML and CSS based webpage that meets the requirements you specified:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>User Info Form</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="container">
<h1>User Info Form</h1>
<form id="userForm">
<div class="form-group">
<label for="firstName">First Name:</label>
<input type="text" id="firstName" required>
</div>
<div class="form-group">
<label for="middleInitial">Middle Initial:</label>
<input type="text" id="middleInitial" maxlength="1">
</div>
<div class="form-group">
<label for="lastName">Last Name:</label>
<input type="text" id="lastName" required>
</div>
<div class="form-group">
<label for="accountNumber">Account Number:</label>
<input type="text" id="accountNumber" required>
</div>
<div class="form-group">
<label for="fileInput">File:</label>
<input type="file" id="fileInput" accept=".txt, .pdf">
</div>
<button type="button" onclick="runForm()">Run</button>
<button type="button" onclick="clearUserInfo()">Clear User Info</button>
<button type="button" onclick="clearFile()">Clear File</button>
</form>
</div>
<script src="script.js"></script>
</body>
</html>
CSS (styles.css):
.container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
text-align: center;
}
.form-group {
margin-bottom: 10px;
}
label {
display: inline-block;
width: 150px;
text-align: right;
margin-right: 10px;
}
input[type="text"],
input[type="file"] {
width: 200px;
padding: 5px;
}
button {
margin-top: 10px;
}
JavaScript (script.js):
function runForm() {
var firstName = document.getElementById('firstName').value;
var middleInitial = document.getElementById('middleInitial').value.toUpperCase();
var lastName = document.getElementById('lastName').value;
var accountNumber = document.getElementById('accountNumber').value;
var fileInput = document.getElementById('fileInput').files[0];
// Perform any desired operations with the form data, such as validation or data processing
console.log('First Name:', firstName);
console.log('Middle Initial:', middleInitial);
console.log('Last Name:', lastName);
console.log('Account Number:', accountNumber);
console.log('File:', fileInput);
// Clear the form inputs
document.getElementById('firstName').value = '';
document.getElementById('middleInitial').value = '';
document.getElementById('lastName').value = '';
document.getElementById('accountNumber').value = '';
}
function clearUserInfo() {
document.getElementById('firstName').value = '';
document.getElementById('middleInitial').value = '';
document.getElementById('lastName').value = '';
document.getElementById('accountNumber').value = '';
}
function clearFile() {
document.getElementById('fileInput').value = '';
}
Save the HTML code in a file called "index.html", the CSS code in a file called "styles.css", and the JavaScript code in a file called "script.js" (keep all files in the same folder). You can then open the HTML file in a web browser to see the webpage in action.