Menu
- 14. A web application for implementation: The user is first served a login page which takes user's name and password. After Submitting the details the server checks these values against the data from a database and takes the following decisions.
- • If name and password matches, serves a welcome page with user's full name.
- • If name matches and password doesn't match, then serves “password mismatch” page
- • If name is not found in the database, serves a registration page, where user’s full name is asked and on submitting the full name, it stores, the login name, password and full name in the database (hint: use session for storing the submitted login name and password)
Aim: Write an HTML page that contains a selection box with a list of 5 countries. When the user selects a country, its capital should be printed next to the list. Add CSS to customize the properties of the font of the capital (color, bold and font size).
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Select Here</title>
<style>
body {
background-image: url('https://img.freepik.com/premium-photo/illustrate-beauty-diversity-with-dynamic-stock-photo-showcasing-world-map-vector-formed-b_997534-28603.jpg'); /* Direct Image URL */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
text-align: center;
font-family: Arial, sans-serif;
color: white;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
select {
color: green;
font-size: 18px;
padding: 10px;
background: rgba(255, 255, 255, 0.8);
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Select a Country</h2>
<select id="country" onchange="displayCapital(this)">
<option value="Washington DC">USA</option>
<option value="New Delhi">India</option>
<option value="Beijing">China</option>
<option value="Tokyo">Japan</option>
<option value="Berlin">Germany</option>
</select>
<script>
function displayCapital(change) {
var value = change.value;
alert('Capital is: ' + value);
}
</script>
</body>
</html>