Assignment
Assignment
: 6675
Assignment No. :1
Assignment Name : Webpage having link to another page
Q1. Create a web page having link to another web page containing a gallery of
image.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: white;
text-align: center;
padding: 1em;
}
.content {
text-align: center;
padding: 20px;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px;
position: absolute;
bottom: 0;
width: 100%;
}.link a {
text-decoration: none;
color: #333;
font-size: 20px;
font-weight: bold;
}.link a:hover {
color: #007BFF;
}
</style>
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
</header>
<div class="content">
<h2>Explore My Image Gallery</h2>
<p>Click the link below to view a collection of beautiful images.</p>
<div class="link">
<a href="p2[2].html">Go to the Gallery</a>
</div>
</div>
<footer>
<p>© 2024 My Website</p>
</footer>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Text, Color, Border & Size Properties</title>
<style>
/* General Body Styling */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
text-align: center;
}
/* Header Styling */
header {
background-color: #4CAF50;
color: white;
padding: 20px;
}
h1 {
font-size: 3em;
margin: 0;
}
h2 {
font-size: 2em;
color: #333;
margin-top: 0;
}
/* Text Styling */
.text-demo {
font-size: 1.5em;
color: #2c3e50;
text-align: left;
padding: 20px;
margin: 10px;
background-color: #ecf0f1;
border: 2px solid #bdc3c7;
border-radius: 10px;
.text-demo strong {
color: #e74c3c;
}
/* Border Styling */
.border-demo {
border: 4px solid #3498db;
padding: 20px;
margin-top: 30px;
width: 80%;
margin-left: auto;
margin-right: auto;
border-radius: 15px;
}
<p>This section demonstrates the <code>border</code> property. The border has a
<code>4px</code> solid blue color and a <code>border-radius</code> of <code>15px</code> to
give it rounded corners. It also has padding and margin for spacing.</p>
</section>
<section class="color-demo">
<h3>Color Styling</h3>
<p>The background color of this section is set using the <code>background-color</code>
property, and the text color is set using the <code>color</code> property. The link inside changes
color when hovered over using the <code>a:hover</code> selector.</p>
<p>For example, visit <a href="https://www.example.com">this link</a> to see the hover
effect!</p>
</section>
<section class="size-demo">
<h3>Size Styling</h3>
<p>This section demonstrates how the <code>font-size</code> property affects the size of the
text. We have a heading with a larger font size, and the text is wrapped in a box with padding and
background color. The font size also adjusts responsively for smaller screens using the
<code>@media</code> query.</p>
</section>
</body>
</html>
Roll No. : 6675
Assignment No. :3
Assignment Name : Webpage having use of header, footer and navigation.
Q3. Design a web page having three section Header, Footer and Navigation bar. Use
<div>, <spam> ,<ul>, and CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Web Page with Header, Footer, and Navigation Bar</title>
<style>
/* General Body Styling */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
/* Header Section */
header {
background-color: #4CAF50;
color: white;
padding: 20px 0;
text-align: center;
}
header h1 {
margin: 0;
}
/* Navigation Bar Styling */
nav {
background-color: #333;
overflow: hidden;
}
nav ul li {
float: left;
}
nav ul l a {
display: block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
nav ul lia:hover {
background-color: #575757;
.content h2 {
color: #333;
}
.content p {
font-size: 1.1em;
line-height: 1.6;
color: #555;
}
/* Footer Section */
footer {
background-color: #333;
color: white;}
/* Clearfix for Navigation Bar */
nav::after {
content: "";
display: table;
clear: both;
}
</style>
</head>
</header>
<!-- Navigation Bar Section -->
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<!-- Main Content Section -->
<div class="content">
<h2>About Us</h2>
with CSS styling. We have a header, a navigation bar, and a footer, all styled using basic CSS
properties.</p>
<p>Feel free to modify and experiment with the layout to suit your needs!</p>
</div>
<!-- Footer Section -->
<footer>
<span>© 2024 My Website. All rights reserved.</span>
</footer>
</body>
Roll No. : 6675
Assignment No. :4
Assignment Name : Webpage to perform simple arithmetic operation.
<div class="container">
<h1>Simple Calculator</h1>
<input type="number" id="num1" placeholder="Enter number" />
<br>
<input type="number" id="num2" placeholder="Enter number" />
<br>
<select id="operation">
<option value="add">Add (+)</option>
<option value="subtract">Subtract (-)</option>
<option value="multiply">Multiply (×)</option>
<option value="divide">Divide (÷)</option>
</select>
<br>
<button onclick="calculate()">Calculate</button>
<div class="result" id="result"></div>
</div>
var result;
switch (operation) {
case "add":
result = num1 + num2;
break;
case "subtract":
result = num1 - num2;
break;
case "multiply":
result = num1 * num2;
break;
case "divide":
if (num2 === 0) {
resultDiv.textContent = "Error: Division by zero is not allowed.";
resultDiv.style.color = "red";
return;
}
result = num1 / num2;
break;
default:
resultDiv.textContent = "Please select a valid operation.";
resultDiv.style.color = "red";
return;
}
</body>
</html>
Roll No. : 6675
Assignment No. :4
Assignment Name : HTML form using javascript.
Q4. Design a HTML form with the following fields and validate user input using
JavaScript: Roll No., Name and Email address.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Validation</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0
button:hover {
background-color: #45a049;
}
.error {
color: red;
font-size: 14px;
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<h2>Form Validation</h2>
<form id="userForm" onsubmit="return validateForm()">
<label for="rollNo">Roll No.</label>
<input type="number" id="rollNo" name="rollNo" placeholder="Enter Roll No." required>
<label for="name">Name</label>
<input type="text" id="name" name="name" placeholder="Enter Name" required>
<label for="email">Email Address</label>
<input type="email" id="email" name="email" placeholder="Enter Email" required>
<button type="submit">Submit</button>
</form>
<div id="errorMessages"></div>
</div>
<script>
function validateForm() {
// Clear previous error messages
document.getElementById("errorMessages").innerHTML = "";
errorMessage.classList.add("error");
errorMessage.textContent = message;
errorMessages.appendChild(errorMessage);
}
</script>
</body>
</html>
Roll No. : 6675
Assignment No. :5
Assignment Name : Webpage converting degree celsius to fahrenheit.
Q5. Design a web page to input temperature in degree Celsius. Convert the
temperature to degree Fahrenheit using PHP script.
<?php
// Initialize variable to store the Fahrenheit result
$fahrenheit = "";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temperature Converter</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f9;
}
.container {
background-color: #fff;
padding: 30px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
width: 300px;
}
input[type="number"] {
padding: 8px;
font-size: 16px;
width: 100%;
margin-bottom: 15px;
}
button {
padding: 10px;
font-size: 16px;
cursor: pointer;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
width: 100%;
}
button:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
font-size: 18px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h2>Temperature Converter</h2>
<form method="POST">
<label for="celsius">Enter temperature in Celsius:</label><br><br>
<input type="number" id="celsius" name="celsius" required step="any" value="<?=
isset($_POST['celsius']) ? $_POST['celsius'] : ''; ?>">
<button type="submit">Convert to Fahrenheit</button>
</form>
</body>
</html>
113
Roll No. : 6675
Assignment No. :6
Assignment Name : Webpage having use of php to check number is odd/even.
Q6. Design a web page to input a number. Using PHP script check whether given
number is Odd/Even
<?php
// Initialize variable to store the result
$result = "";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Odd or Even Checker</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f9;
}
.container {
background-color: #fff;
padding: 30px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
width: 300px;
}
input[type="number"] {
padding: 8px;
font-size: 16px;
width: 100%;
margin-bottom: 15px;
}
button {
padding: 10px;
font-size: 16px;
cursor: pointer;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
width: 100%;
}
button:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
font-size: 18px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h2>Odd or Even Checker</h2>
<form method="POST">
<label for="number">Enter a number:</label><br><br>
<input type="number" id="number" name="number" required>
<button type="submit">Check</button>
</form>
</body>
</html>
Odd
Roll No. : 6675
Assignment No. :7
Assignment Name : Webpage having use of php to check number is palindrome or
armstrong.
Q12. Design a web page to input a number. Using PHP script check whether given
number is Palindrome / Armstrong and display message in web page accordingly.
<?php
// Initialize variables to store the results
$palindromeResult = "";
$armstrongResult = "";
if ($sum == $originalNumber) {
$armstrongResult = "The number is an Armstrong number.";
} else {
$armstrongResult = "The number is not an Armstrong number.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Palindrome and Armstrong Checker</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f9;
button {
button:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
font-size: 18px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h2>Palindrome and Armstrong Checker</h2>
<form method="POST">
<label for="number">Enter a number:</label><br><br>
<input type="number" id="number" name="number" required>
<button type="submit">Check</button>
</form>
<?php if ($palindromeResult !== "" || $armstrongResult !== ""): ?>
<div class="result">
<strong>Result:</strong><br>
<?php echo $palindromeResult; ?><br>
<?php echo $armstrongResult; ?>
</div>
<?php endif; ?>
</div>
</body>
</html>
NO
NO
Roll No. : 6675
Assignment No. :8
Assignment Name : Webpage having use php to check number is prime or not.
Q13. Design a web page to input a number. Using PHP script check whether given
number is prime or not.
<?php
// Initialize the result message
$primeResult = "";
<div class="container">
<h2>Prime Number Checker</h2>
<form method="POST">
<label for="number">Enter a number:</label><br><br>
<input type="number" id="number" name="number" required>
<button type="submit">Check</button>
</form>
</body>
</html>
Not prime