-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 55ae3f3
Showing
14 changed files
with
654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!ELEMENT eCommerce (product+)> | ||
<!ELEMENT product (productId, productName, productCost, purchasedDate, purchasedBy, sellerName)> | ||
|
||
<!ELEMENT productId (#PCDATA)> | ||
<!ELEMENT productName (#PCDATA)> | ||
<!ELEMENT productCost (#PCDATA)> | ||
<!ELEMENT purchasedDate (#PCDATA)> | ||
<!ELEMENT purchasedBy (#PCDATA)> | ||
<!ELEMENT sellerName (#PCDATA)> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>E-commerce Product Form</title> | ||
</head> | ||
|
||
<body> | ||
<h1>Product Information Form</h1> | ||
<form action="process.xml" method="post"> | ||
<label for="productId">Product ID:</label> | ||
<input type="text" id="productId" name="productId" required><br><br> | ||
|
||
<label for="productName">Product Name:</label> | ||
<input type="text" id="productName" name="productName" required><br><br> | ||
|
||
<label for="productCost">Product Cost:</label> | ||
<input type="number" id="productCost" name="productCost" required><br><br> | ||
|
||
<label for="purchasedDate">Purchased Date:</label> | ||
<input type="date" id="purchasedDate" name="purchasedDate" required><br><br> | ||
|
||
<label for="purchasedBy">Purchased By:</label> | ||
<input type="text" id="purchasedBy" name="purchasedBy" required><br><br> | ||
|
||
<label for="sellerName">Seller Name:</label> | ||
<input type="text" id="sellerName" name="sellerName" required><br><br> | ||
|
||
<button type="submit">Submit</button> | ||
</form> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE eCommerce SYSTEM "eCommerce.dtd"> | ||
<eCommerce> | ||
<product> | ||
<productId>12345</productId> | ||
<productName>Wireless Mouse</productName> | ||
<productCost>20.99</productCost> | ||
<purchasedDate>2024-11-19</purchasedDate> | ||
<purchasedBy>John Doe</purchasedBy> | ||
<sellerName>Best Electronics</sellerName> | ||
</product> | ||
|
||
<product> | ||
<productId>67890</productId> | ||
<productName>Keyboard</productName> | ||
<productCost>30.50</productCost> | ||
<purchasedDate>2024-11-15</purchasedDate> | ||
<purchasedBy>Jane Smith</purchasedBy> | ||
<sellerName>Tech World</sellerName> | ||
</product> | ||
</eCommerce> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Static array of ten numbers | ||
const numbers = [5, -3, 0, 12, -7, 0, 8, -1, 0, 4]; | ||
|
||
// Initialize counters | ||
let negativeCount = 0; | ||
let positiveCount = 0; | ||
let zeroCount = 0; | ||
|
||
// Loop through the numbers and count positives, negatives, and zeros | ||
numbers.forEach((num) => { | ||
if (num < 0) { | ||
negativeCount++; | ||
} else if (num > 0) { | ||
positiveCount++; | ||
} else { | ||
zeroCount++; | ||
} | ||
}); | ||
|
||
// Display the results | ||
console.log(`Positive numbers count: ${positiveCount}`); | ||
console.log(`Negative numbers count: ${negativeCount}`); | ||
console.log(`Zero count: ${zeroCount}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Alumni Form</title> | ||
<style> | ||
form { | ||
width: 300px; | ||
margin: 20px auto; | ||
padding: 15px; | ||
border: 1px solid #ccc; | ||
border-radius: 8px; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
margin: 10px 0; | ||
padding: 8px; | ||
} | ||
|
||
.error { | ||
color: red; | ||
font-size: 12px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h2 style="text-align: center;">Alumni Form</h2> | ||
<form id="alumniForm" onsubmit="return validateForm()"> | ||
<input type="text" id="name" placeholder="Name"> | ||
<span class="error" id="nameError"></span> | ||
|
||
<input type="text" id="address" placeholder="Address"> | ||
<span class="error" id="addressError"></span> | ||
|
||
<input type="date" id="dob" placeholder="Date of Birth"> | ||
<span class="error" id="dobError"></span> | ||
|
||
<input type="text" id="email" placeholder="Email"> | ||
<span class="error" id="emailError"></span> | ||
|
||
<button type="submit">Submit</button> | ||
</form> | ||
|
||
<script> | ||
function validateForm() { | ||
const name = document.getElementById("name").value.trim(); | ||
const address = document.getElementById("address").value.trim(); | ||
const dob = document.getElementById("dob").value; | ||
const email = document.getElementById("email").value.trim(); | ||
|
||
const nameError = document.getElementById("nameError"); | ||
const addressError = document.getElementById("addressError"); | ||
const dobError = document.getElementById("dobError"); | ||
const emailError = document.getElementById("emailError"); | ||
|
||
// Reset errors | ||
nameError.textContent = ""; | ||
addressError.textContent = ""; | ||
dobError.textContent = ""; | ||
emailError.textContent = ""; | ||
|
||
let isValid = true; | ||
|
||
// Check if all fields are filled | ||
if (name === "") { | ||
nameError.textContent = "Name is required."; | ||
isValid = false; | ||
} | ||
|
||
if (address === "") { | ||
addressError.textContent = "Address is required."; | ||
isValid = false; | ||
} | ||
|
||
if (dob === "") { | ||
dobError.textContent = "Date of Birth is required."; | ||
isValid = false; | ||
} else { | ||
const birthYear = new Date(dob).getFullYear(); | ||
const currentYear = new Date().getFullYear(); | ||
const age = currentYear - birthYear; | ||
|
||
if (age < 22) { | ||
dobError.textContent = "You must be at least 22 years old."; | ||
isValid = false; | ||
} | ||
} | ||
|
||
// Validate email | ||
if (email === "" || !email.includes("@") || !email.includes(".")) { | ||
emailError.textContent = "Enter a valid email address."; | ||
isValid = false; | ||
} | ||
|
||
return isValid; | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Simple Form Validation</title> | ||
<style> | ||
form { | ||
width: 300px; | ||
margin: auto; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
margin: 10px 0; | ||
padding: 8px; | ||
} | ||
|
||
.error { | ||
color: red; | ||
font-size: 12px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h2 style="text-align: center;">Form Validation</h2> | ||
<form id="myForm" onsubmit="return validateForm()"> | ||
<input type="text" id="name" placeholder="Name (A-Z)"> | ||
<span class="error" id="nameError"></span> | ||
|
||
<input type="number" id="age" placeholder="Age (0-100)"> | ||
<span class="error" id="ageError"></span> | ||
|
||
<input type="text" id="email" placeholder="Email (must contain @)"> | ||
<span class="error" id="emailError"></span> | ||
|
||
<input type="password" id="password" placeholder="Password"> | ||
<span class="error" id="passwordError"></span> | ||
|
||
<button type="submit">Submit</button> | ||
</form> | ||
|
||
<script> | ||
function validateForm() { | ||
const name = document.getElementById("name").value.trim(); | ||
const age = document.getElementById("age").value.trim(); | ||
const email = document.getElementById("email").value.trim(); | ||
const password = document.getElementById("password").value.trim(); | ||
|
||
const nameError = document.getElementById("nameError"); | ||
const ageError = document.getElementById("ageError"); | ||
const emailError = document.getElementById("emailError"); | ||
const passwordError = document.getElementById("passwordError"); | ||
|
||
// Clear previous error messages | ||
nameError.textContent = ""; | ||
ageError.textContent = ""; | ||
emailError.textContent = ""; | ||
passwordError.textContent = ""; | ||
|
||
let isValid = true; | ||
|
||
// Validate Name | ||
if (!/^[A-Za-z]+$/.test(name)) { | ||
nameError.textContent = "Name must only contain letters (A-Z)."; | ||
isValid = false; | ||
} | ||
|
||
// Validate Age | ||
if (age === "" || age < 0 || age > 100) { | ||
ageError.textContent = "Age must be between 0 and 100."; | ||
isValid = false; | ||
} | ||
|
||
// Validate Email | ||
if (!email.includes("@")) { | ||
emailError.textContent = "Email must contain '@'."; | ||
isValid = false; | ||
} | ||
|
||
// Validate Password | ||
const passwordRegex = /^(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]).{6,}$/; | ||
if (!passwordRegex.test(password)) { | ||
passwordError.textContent = | ||
"Password must include 1 uppercase letter, 1 number, 1 special character, and be at least 6 characters."; | ||
isValid = false; | ||
} | ||
|
||
return isValid; | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<h1>Hello World</h1> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?xml-stylesheet type="text/xsl" href="library.xsl"?> | ||
<library> | ||
<book> | ||
<name>The Great Gatsby</name> | ||
<author>F. Scott Fitzgerald</author> | ||
<publisher>Charles Scribner's Sons</publisher> | ||
<year>1925</year> | ||
</book> | ||
<book> | ||
<name>1984</name> | ||
<author>George Orwell</author> | ||
<publisher>Secker & Warburg</publisher> | ||
<year>1949</year> | ||
</book> | ||
<book> | ||
<name>To Kill a Mockingbird</name> | ||
<author>Harper Lee</author> | ||
<publisher>J.B. Lippincott & Co.</publisher> | ||
<year>1960</year> | ||
</book> | ||
<book> | ||
<name>The Catcher in the Rye</name> | ||
<author>J.D. Salinger</author> | ||
<publisher>Little, Brown and Company</publisher> | ||
<year>1951</year> | ||
</book> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
<xsl:template match="/"> | ||
<html> | ||
<head> | ||
<title>Library Catalogue</title> | ||
<style> | ||
table { | ||
width: 80%; | ||
border-collapse: collapse; | ||
margin: 20px auto; | ||
font-family: Arial, sans-serif; | ||
} | ||
th, td { | ||
border: 1px solid #ddd; | ||
padding: 8px; | ||
text-align: center; | ||
} | ||
th { | ||
background-color: #f4f4f4; | ||
font-weight: bold; | ||
} | ||
tr:nth-child(even) { | ||
background-color: #f9f9f9; | ||
} | ||
tr:hover { | ||
background-color: #f1f1f1; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 style="text-align: center;">Library Catalogue</h1> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name of the Book</th> | ||
<th>Author</th> | ||
<th>Publisher</th> | ||
<th>Year of Publishing</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<xsl:for-each select="library/book"> | ||
<tr> | ||
<td><xsl:value-of select="name" /></td> | ||
<td><xsl:value-of select="author" /></td> | ||
<td><xsl:value-of select="publisher" /></td> | ||
<td><xsl:value-of select="year" /></td> | ||
</tr> | ||
</xsl:for-each> | ||
</tbody> | ||
</table> | ||
</body> | ||
</html> | ||
</xsl:template> | ||
</xsl:stylesheet> |
Oops, something went wrong.