Web Technologies
Web Technologies
<products>
<product>
<id>1</id>
<name>Product A</name>
<price>100</price>
</product>
<product>
<id>2</id>
<name>Product B</name>
<price>150</price>
</product>
<product>
<id>3</id>
<name>Product C</name>
<price>200</price>
</product>
</products>
<orders>
<order>
<product>Product A</product>
<quantity>2</quantity>
<total>200</total>
</order>
<order>
<product>Product B</product>
<quantity>1</quantity>
<total>150</total>
</order>
<order>
<product>Product C</product>
<quantity>3</quantity>
<total>600</total>
</order>
</orders>
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
</head>
<body>
<header>
</header>
<section class=”products”>
<h2>Available Products</h2>
<div id=”productList”></div>
</section>
<section class=”orders”>
<h2>Order History</h2>
<table id=”orderTable”>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Total</th>
</tr>
</table>
</section>
<script src=”script.js”></script>
</body>
</html>
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>Create User</title>
</head>
<body class=”gradient-bg”>
<div class=”form-container”>
<h2>Create User</h2>
<form id=”userForm”>
</form>
</div>
<script>
Document.getElementById(“userForm”).addEventListener(“submit”, function(event) {
Event.preventDefault();
<name>${document.getElementById(“name”).value}</name>
<email>${document.getElementById(“email”).value}</email>
<phone>${document.getElementById(“phone”).value}</phone>
<dob>${document.getElementById(“dob”).value}</dob>
<password>${document.getElementById(“password”).value}</password>
</user>`;
Xhr.setRequestHeader(“Content-Type”, “application/xml”);
Xhr.send(formData);
Xhr.onload = function() {
If (xhr.status == 200) {
} else {
};
});
</script>
</body>
</html>
loadProducts();
loadOrders();
});
Function loadProducts() {
Xhr.send();
Xhr.onload = function() {
If (xhr.status == 200) {
productDiv.classList.add(“product”);
productDiv.innerHTML = `<p>${name}</p>
<p>$${price}</p>
productList.appendChild(productDiv);
};
Function loadOrders() {
Xhr.send();
Xhr.onload = function() {
If (xhr.status == 200) {
Row.innerHTML = `<td>${product}</td>
<td>${quantity}</td>
<td>$${total}</td>`;
};
6. Style.css (Styling)
Body {
Margin: 0;
Padding: 0;
Text-align: center;
Background-color: #f8f8f8;
Header {
Background-color: #ff0077;
Color: white;
Padding: 15px;
}
Button {
Background-color: #ff0077;
Color: white;
Border: none;
Cursor: pointer;
.products, .orders {
Margin: 20px;
Padding: 20px;
Background: white;
.product {
Padding: 10px;
Display: inline-block;
Margin: 10px;
Table {
Width: 100%;
Border-collapse: collapse;
Th, td {
Padding: 10px;
Th {
Background-color: #ff0077;
Color: white;
2.Ticket booking
<movies>
<movie>
<genre>Action</genre>
<totalSeats>50</totalSeats>
<price>10</price>
</movie>
<movie>
<genre>Comedy</genre>
<totalSeats>60</totalSeats>
<price>8</price>
</movie>
</movies>
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
</head>
<body>
<h2>Booked Movies</h2>
<table id=”bookedMovies”>
<tr>
<th>Movie Title</th>
<th>Seats</th>
<th>Total Price</th>
</tr>
</table>
</div>
<script src=”script.js”></script>
</body>
</html>
3. addMovie.html (Adding New Movies)
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>Add Movie</title>
</head>
<body>
<h1>Add Movie</h1>
<div class=”container”>
<label for=”movieTitle”>Title:</label>
<label for=”genre”>Genre:</label>
<label for=”price”>Price:</label>
</div>
<script src=”script.js”></script>
</body>
</html>
Body {
Text-align: center;
Margin: 0;
Padding: 0;
}
H1 {
Color: white;
Padding: 10px;
.container {
Background: white;
Padding: 20px;
Width: 50%;
Margin: auto;
Margin-top: 20px;
Border-radius: 5px;
Button {
Color: white;
Border: none;
Padding: 10px;
Cursor: pointer;
Border-radius: 3px;
}
Button:hover {
Table {
Width: 100%;
Margin-top: 10px;
Border-collapse: collapse;
Table, th, td {
Th {
Color: white;
Padding: 10px;
Td {
Padding: 10px;
A{
Display: inline-block;
Margin: 10px;
Color: white;
Text-decoration: none;
Border-radius: 3px;
A:hover {
Background-color: #2e7d32;
Function loadMovies() {
Xhr.onreadystatechange = function () {
Select.innerHTML = “”;
Option.value = price;
Option.textContent = title;
Select.appendChild(option);
updatePrice();
};
Xhr.send();
Function updatePrice() {
}
// Book Ticket
Function bookTicket() {
Row.insertCell(0).textContent = movieTitle;
Row.insertCell(1).textContent = seats;
Function addMovie() {
sessionStorage.setItem(“newMovie”, newMovie);
Window.onload = loadMovies;