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 including javascript that takes a given set of integer numbers and shows them after sorting in descending order
Program: Sort Numbers in Descending Order
<!DOCTYPE html>
<html>
<head>
<title>Sort Numbers in Descending Order</title>
</head>
<body>
<h2>Enter numbers separated by commas:</h2>
<input type="text" id="numbers" />
<button onclick="sortNumbers()">Sort</button>
<h2>Sorted Numbers:</h2>
<div id="sorted-numbers"></div>
<script>
function sortNumbers() {
var numbers = document.getElementById("numbers").value;
var numArray = numbers.split(",").map(Number);
numArray.sort(function(a, b) {
return b - a;
});
document.getElementById("sorted-numbers").innerHTML = numArray.join(", ");
}
</script>
</body>
</html>