Weprgms 083422
Weprgms 083422
<!DOCTYPE html>
<html lang="en">
<head>
<title> My First Web Page</title>
</head>
<body>
<marquee>Basic HTML Tags</marquee>
<h1>SRIDHAR</h1>
<h2>SRIDHAR</h2>
<h3>SRIDHAR</h3>
<h4>SRIDHAR</h4>
<h5>SRIDHAR</h5>
<h6>SRIDHAR</h6>
<p>Web application with HTML, CSS, JavaScript, jQuery and PHP for
online application/registration form.</p>
<hr>
<blockquote><q>Block<br> Quote</q></blockquote>
<pre> Pre tag Analyze the results and produce substantial written
documentation.</pre>
<p>
This is <b>bold</b> text.<br>
This is <u>underlined</u> text.<br>
This is <sub>subscript</sub> text.<br>
This is <sup>superscript</sup> text.<br>
</p>
</body>
</html>
Program 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Time Table</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 10px;
text-align: center;
}
th {
background-color: #f2f2f2;
}
.lab {
background-color: #ffeb3b; /* Yellow for lab hours */
}
.elective {
background-color: #80deea; /* Light blue for elective hours
*/
}
.highlight-row {
background-color: #d1c4e9; /* Light purple for rows */
}
footer {
text-align: center;
padding: 10px;
background-color: #f2f2f2;
margin-top: 10px;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Time</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
</thead>
<tbody>
<tr class="highlight-row">
<td>9:00 - 10:00</td>
<td>Maths</td>
<td class="lab">Lab - Physics</td>
<td>Maths</td>
<td class="elective">Elective</td>
<td>English</td>
</tr>
<tr>
<td>10:00 - 11:00</td>
<td>English</td>
<td>Maths</td>
<td>Lab - Chemistry</td>
<td class="elective">Elective</td>
<td class="lab">Lab - Biology</td>
</tr>
<tr class="highlight-row">
<td>11:00 - 12:00</td>
<td class="lab">Lab - Computer</td>
<td>English</td>
<td class="lab">Lab - Chemistry</td>
<td>Maths</td>
<td class="elective">Elective</td>
</tr>
<tr>
<td>12:00 - 1:00</td>
<td>Break</td>
<td>Break</td>
<td>Break</td>
<td>Break</td>
<td>Break</td>
</tr>
<tr class="highlight-row">
<td>1:00 - 2:00</td>
<td class="elective">Elective</td>
<td>Maths</td>
<td>English</td>
<td>Lab - Physics</td>
<td>Lab - Biology</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6">This is your weekly class time
table.</td>
</tr>
</tfoot>
</table>
</body>
</html>
Program 3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>CSS Demonstration</title>
<link rel="stylesheet" href="3.style.css"> <!-- Link to external
CSS file -->
</head>
<body>
<h2>This is an H2 Heading</h2>
<h3>This is an H3 Heading</h3>
<hr>
<div class="highlight">
<p>This is inside a div with class 'highlight'. It has special
styling.</p>
</div>
</body>
</html>
Style.css
/* style.css */
Program 4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f7f7f7;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
.form-container {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
width: 300px;
margin: 0 auto;
}
table {
width: 100%;
margin-bottom: 20px;
}
td {
padding: 10px;
}
input[type="text"], input[type="email"],
input[type="password"], input[type="tel"], input[type="date"], select {
width: 100%;
padding: 8px;
margin: 5px 0;
border: 1px solid #ddd;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
input[type="submit"]:hover {
background-color: #45a049;
}
label {
font-size: 14px;
color: #333;
}
</style>
</head>
<body>
<h1>Registration Form</h1>
<div class="form-container">
<form action="#" method="post">
<table>
<tr>
<td><label for="first-name">First
Name:</label></td>
<td><input type="text" id="first-name" name="first-
name" required></td>
</tr>
<tr>
<td><label for="last-name">Last Name:</label></td>
<td><input type="text" id="last-name" name="last-
name" required></td>
</tr>
<tr>
<td><label for="email">Email:</label></td>
<td><input type="email" id="email" name="email"
required></td>
</tr>
<tr>
<td><label for="password">Password:</label></td>
<td><input type="password" id="password"
name="password" required></td>
</tr>
<tr>
<td><label for="phone">Phone:</label></td>
<td><input type="tel" id="phone" name="phone"
pattern="[0-9]{10}" required></td>
</tr>
<tr>
<td><label for="dob">Date of Birth:</label></td>
<td><input type="date" id="dob" name="dob"
required></td>
</tr>
<tr>
<td><label for="gender">Gender:</label></td>
<td>
<input type="radio" id="male" name="gender"
value="male" required> Male
<input type="radio" id="female" name="gender"
value="female" required> Female
</td>
</tr>
<tr>
<td><label for="country">Country:</label></td>
<td>
<select id="country" name="country" required>
<option value="us">United States</option>
<option value="uk">United Kingdom</option>
<option value="ca">Canada</option>
<option value="in">India</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="submit" value="Register">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
Program 5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Newspaper</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: white;
padding: 10px;
text-align: center;
}
nav {
background-color: #444;
padding: 10px;
text-align: center;
}
nav a {
color: white;
margin: 0 10px;
text-decoration: none;
}
main {
display: flex;
padding: 20px;
}
article {
flex: 70%;
padding: 20px;
background-color: white;
margin-right: 20px;
}
aside {
flex: 30%;
background-color: #e0e0e0;
padding: 20px;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px;
position: fixed;
width: 100%;
bottom: 0;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 8px;
border: 1px solid #ccc;
}
th {
background-color: #444;
color: white;
}
</style>
</head>
<body>
<header>
<h1>Daily News</h1>
</header>
<nav>
<a href="#">Home</a>
<a href="#">World</a>
<a href="#">Business</a>
<a href="#">Technology</a>
</nav>
<main>
<article>
<h2>Market Hits New High</h2>
<section>
<h3>Stock Prices Surge</h3>
<p>Today, the stock market hit a record high due to
strong economic growth...</p>
</section>
<section>
<h3>Tech Sector Leads the Charge</h3>
<p>Tech companies are leading the market rally with
strong earnings reports...</p>
</section>
<figure>
<img src="https://via.placeholder.com/600x300"
alt="Stock Market" width="600">
<figcaption>Stock Market Surge</figcaption>
</figure>
<table>
<caption>Top 5 Performing Stocks</caption>
<tr>
<th>Company</th>
<th>Price</th>
<th>Change</th>
</tr>
<tr>
<td>Apple</td>
<td>$145</td>
<td>+2%</td>
</tr>
<tr>
<td>Amazon</td>
<td>$3400</td>
<td>+1.5%</td>
</tr>
<tr>
<td>Microsoft</td>
<td>$300</td>
<td>+1.2%</td>
</tr>
</table>
</article>
<aside>
<h3>Opinion</h3>
<p>While the market is booming, many are still struggling
to recover from the pandemic...</p>
</aside>
</main>
<footer>
<p>© 2024 Daily News</p>
</footer>
</body>
</html>
Program6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Simple Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
}
input, button {
padding: 10px;
margin: 5px;
}
input {
width: 150px;
}
button {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h2>Simple Calculator</h2>
<input type="number" id="num1" placeholder="Enter first number">
<input type="number" id="num2" placeholder="Enter second number">
<br><br>
<button onclick="calculate('sum')">Sum</button>
<button onclick="calculate('difference')">Difference</button>
<button onclick="calculate('product')">Product</button>
<button onclick="calculate('quotient')">Quotient</button>
<button onclick="calculate('remainder')">Remainder</button>
<button onclick="calculate('power')">Power</button>
<button onclick="calculate('sqrt')">Square Root</button>
<button onclick="calculate('square')">Square</button>
<h3 id="result"></h3>
<script>
function calculate(operation) {
var num1 =
parseFloat(document.getElementById('num1').value);
var num2 =
parseFloat(document.getElementById('num2').value);
var result = 0;
var message = "";
if (isNaN(num1) || isNaN(num2)) {
message = "Please enter valid numbers!";
} else {
switch (operation) {
case 'sum':
result = num1 + num2;
message = "Sum: " + result;
break;
case 'difference':
result = num1 - num2;
message = "Difference: " + result;
break;
case 'product':
result = num1 * num2;
message = "Product: " + result;
break;
case 'quotient':
if (num2 === 0) {
message = "Cannot divide by zero!";
} else {
result = num1 / num2;
message = "Quotient: " + result;
}
break;
case 'remainder':
result = num1 % num2;
message = "Remainder: " + result;
break;
case 'power':
result = Math.pow(num1, num2);
message = "Power: " + result;
break;
case 'sqrt':
if (num1 < 0) {
message = "Square root of negative number
is not possible!";
} else {
result = Math.sqrt(num1);
message = "Square Root: " + result;
}
break;
case 'square':
result = Math.pow(num1, 2);
message = "Square: " + result;
break;
}
}
document.getElementById('result').innerText = message;
}
</script>
</body>
</html>
Program7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>JSON & Crypto Operations</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background-color: #f4f4f9;
text-align: center;
}
input, button {
padding: 10px;
margin: 5px;
font-size: 16px;
}
textarea {
width: 100%;
height: 100px;
margin: 10px 0;
font-size: 16px;
}
.result {
font-size: 18px;
margin-top: 20px;
}
</style>
</head>
<body>
<script>
// Convert JSON to JavaScript Object
function convertJsonToObject() {
var jsonText = document.getElementById('jsonText').value;
try {
var jsonObject = JSON.parse(jsonText);
document.getElementById('jsonToObjectResult').innerText
= JSON.stringify(jsonObject, null, 2);
} catch (e) {
document.getElementById('jsonToObjectResult').innerText
= "Invalid JSON text!";
}
}
</body>
</html>
Program 9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>jQuery Example</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.animated-div {
width: 150px;
height: 150px;
background-color: lightblue;
margin-top: 20px;
display: inline-block;
text-align: center;
line-height: 150px;
font-size: 18px;
color: black;
position: relative;
}
ul {
margin-top: 20px;
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<script>
// Task 1: Append content to paragraph and list
function appendContent() {
// Append text to paragraph
$('#paragraph').append(' More text added to the
paragraph.');
</body>
</html>