Professional Documents
Culture Documents
Exp 6
Exp 6
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<form name="MyForm" method="post" action="">
<h2>Register your account</h2>
Enter your Firstname: <input type="text" name="FName" id="FName"><br><br>
Enter Your Lastname: <input type="text" name="LName" id="LName"><br><br>
Enter your Username: <input type="text" name="UName" id="UName"><br><br>
Enter your Password: <input type="password" name="pass" id="pass"><br><br>
Enter you Gender: <input type="radio" name="Gender" id="Male">Male
<input type="radio" name="Gender" id="Female">Female<br><br>
Your Hobbies? <input type="checkbox" name="Hobbies" id="Cricket">Cricket
<input type="checkbox" name="Football" id="Cricket">Football<br><br>
Select your city: <select name="City">
<option name="Mumbai">Mumbai</option>
<option name="Pune">Pune</option>
<option name="Nagpur">Nagpur</option>
<option name="Ahmedabad">Ahmedabad</option>
</select><br><br>
<input type="submit"> <input type="reset">
</form>
</body>
</html>
Exercise:
1)Write a program to create the registration form for creating gmail account.
<html>
<head>
<title>Gmail Registration Form</title>
</head>
<body>
<h2>Gmail Registration Form</h2>
<form id="registrationForm" onsubmit="registerAccount(event)">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password" required><br><br>
<script>
function registerAccount(event) {
event.preventDefault();
<html>
<html>
<head>
<title>Checkbox Evaluation</title>
</head>
<body>
<h2>Select your preferences:</h2>
<label>
<input type="checkbox" id="option1"> Option 1
</label><br>
<label>
<input type="checkbox" id="option2"> Option 2
</label><br>
<label>
<input type="checkbox" id="option3"> Option 3
</label><br><br>
<button onclick="evaluateSelection()">Evaluate Selection</button>
<script>
function evaluateSelection() {
const option1Checkbox = document.getElementById('option1');
const option2Checkbox = document.getElementById('option2');
const option3Checkbox = document.getElementById('option3');
if (option1Checkbox.checked) {
selectedOptions.push('Option 1');
}
if (option2Checkbox.checked) {
selectedOptions.push('Option 2');
}
if (option3Checkbox.checked) {
selectedOptions.push('Option 3');
}
if (selectedOptions.length === 0) {
alert('Please select at least one option.');
} else {
alert('Selected options: ' + selectedOptions.join(', '));
}
}
</script>
</body>
</html>
<html>
<html>
<head>
<title>Change Attribute Values Dynamically</title>
</head>
<body>
<h2>Click the button to change the attribute value:</h2>
<button onclick="changeImageSrc()">Change Image Src</button>
<script>
function changeImageSrc() {
const imageElement = document.getElementById('imageElement');