Aman Web F
Aman Web F
Practical – 5
Q.) Create a Menu or Table of Contents webpage.
Each menu item should load a different webpage
Solution –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table of Contents</title>
</head>
<body>
<h1>Table of Contents</h1>
<p>Click on the links below to navigate to different pages:</p>
<ul>
<li><a href="page1.html">Page 1 - Introduction</a></li>
<li><a href="page2.html">Page 2 - About Us</a></li>
<li><a href="page3.html">Page 3 - Services</a></li>
<li><a href="page4.html">Page 4 - Contact</a></li>
</ul>
</body>
</html>
Output –
Web Designing Lab (BCA-307) 1323180
Practical – 6
Q.) Create a form for student registration which have all field required for student
registration.
Solution –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Student Registration</h2>
<label for="email">Email:</label><br>
<label>Gender:</label><br>
<label for="male">Male</label><br>
<label for="female">Female</label><br>
<label for="other">Other</label><br><br>
<option value="BSc">B.Sc.</option>
<option value="BCA">BCA</option>
Web Designing Lab (BCA-307) 1323180
<option value="BBA">BBA</option>
<option value="MBA">MBA</option>
</select><br><br>
</select><br><br>
</form>
</body>
</html>
Output –
Web Designing Lab (BCA-307) 1323180
Web Designing Lab (BCA-307) 1323180
Practical – 7
/* Overall Layout */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
}
/* Header */
header {
background-color: #00274d; /* Dark blue */
color: white;
padding: 1em 0;
text-align: center;
position: sticky;
top: 0;
z-index: 1000;
}
header nav a {
color: white;
margin: 0 10px;
text-decoration: none;
font-weight: bold;
}
/* Section Styles */
section {
padding: 3em 10%;
}
#about {
background-color: #f9f9f9; /* Light beige */
}
#history {
background-color: #fff7e6; /* Pastel yellow */
}
#campus {
background-color: #e0f7ea; /* Light green */
}
#courses {
background-color: #eef3fc; /* Light blue */
}
#features {
background-color: #fff4e6; /* Light orange */
}
#contact {
background-color: #f2f2f2; /* Light grey */
}
/* Footer */
footer {
background-color: #333;
color: white;
text-align: center;
padding: 1em;
}
/* Contact Form */
#contact form {
display: flex;
flex-direction: column;
width: 100%;
max-width: 400px;
margin: 0 auto;
}
<form>
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Your Email" required>
<textarea name="message" placeholder="Your Message" required></textarea>
<button type="submit">Send Message</button>
</form>
</section>
</body>
</html>
Web Designing Lab (BCA-307) 1323180
Output -
Web Designing Lab (BCA-307) 1323180
Practical – 8
Q.) Demonstrate use of multimedia tags (Video & Audio) in HTML document.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multimedia Example - Video & Audio</title>
</head>
<body>
<h1>Multimedia in HTML</h1>
</body>
</html>
Web Designing Lab (BCA-307) 1323180
Output -
Web Designing Lab (BCA-307) 1323180
Practical – 9
Q.) Write HTML documents using Style Sheet for Inline, Internal and External
types.
Solution :
Inline CSS –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inline CSS Example</title>
</head>
<body>
</body>
</html>
Internal CSS –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Internal CSS Example</title>
<style>
/* Internal CSS Styles */
body {
font-family: Arial, sans-serif;
background-color: #f0f8ff;
}
h1 {
color: blue;
text-align: center;
Web Designing Lab (BCA-307) 1323180
}
p{
color: green;
font-size: 18px;
}
.highlight {
background-color: yellow;
padding: 10px;
}
</style>
</head>
<body>
</body>
</html>
external CSS –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>External CSS Example</title>
<link rel="stylesheet" href="styles.css"> <!-- Link to external CSS -->
</head>
<body>
</body>
</html>
Web Designing Lab (BCA-307) 1323180
Practical – 10
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic Calculator</title>
<style>
body, html {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: #f0f0f0;
margin: 0;
font-family: Arial, sans-serif;
}
#calc {
width: 320px;
background: #fff;
border-radius: 10px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
overflow: hidden;
}
#display {
width: 100%;
padding: 15px;
font-size: 2em;
text-align: right;
background: #333;
color: #fff;
box-sizing: border-box;
}
#buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 2px;
}
button {
padding: 20px;
Web Designing Lab (BCA-307) 1323180
font-size: 1.5em;
border: none;
cursor: pointer;
}
button:nth-child(4n+4) {
background: #ff9800;
color: #fff;
}
button:nth-child(-n+3) {
background: #f44336;
color: #fff;
}
button:hover {
filter: brightness(0.9);
}
</style>
</head>
<body>
<div id="calc">
<div id="display"></div>
<div id="buttons">
<button onclick="clearDisplay()">C</button>
<button onclick="appendDisplay('%')">%</button>
<button onclick="appendDisplay('/')">/</button>
<button onclick="appendDisplay('*')">*</button>
<button onclick="appendDisplay('7')">7</button>
<button onclick="appendDisplay('8')">8</button>
<button onclick="appendDisplay('9')">9</button>
<button onclick="appendDisplay('-')">-</button>
<button onclick="appendDisplay('4')">4</button>
<button onclick="appendDisplay('5')">5</button>
<button onclick="appendDisplay('6')">6</button>
<button onclick="appendDisplay('+')">+</button>
<button onclick="appendDisplay('1')">1</button>
<button onclick="appendDisplay('2')">2</button>
<button onclick="appendDisplay('3')">3</button>
<button onclick="calculate()">=</button>
<button onclick="appendDisplay('0')">0</button>
<button onclick="appendDisplay('.')">.</button>
</div>
</div>
Web Designing Lab (BCA-307) 1323180
<script>
const display = document.getElementById("display");
function clearDisplay() {
display.innerText = "";
}
function appendDisplay(val) {
display.innerText += val;
}
function calculate() {
try {
display.innerText = eval(display.innerText);
} catch {
display.innerText = "Error";
}
}
</script>
</body>
</html>
Web Designing Lab (BCA-307) 1323180
Practical – 11
Q.) WAP to display date and time using different JS date formats.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Date and Time Viewer</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f9f9f9;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #ffffff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
width: 80%;
max-width: 600px;
color: #333;
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #4a90e2;
font-size: 1.8em;
}
.date-format {
background-color: #e6f7ff;
Web Designing Lab (BCA-307) 1323180
padding: 10px;
margin: 8px 0;
border-radius: 5px;
font-size: 1.1em;
display: flex;
justify-content: space-between;
color: #333;
}
.label {
font-weight: bold;
color: #4a90e2;
}
.refresh-btn {
background-color: #4a90e2;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
margin-top: 15px;
font-size: 1em;
transition: background-color 0.3s ease;
}
.refresh-btn:hover {
background-color: #4285d4;
}
</style>
</head>
<body>
<div class="container">
<h1>Date and Time Viewer</h1>
<div id="formattedDates">
<!-- Date and time formats will be shown here -->
</div>
<button class="refresh-btn" onclick="displayDateFormats()">Refresh
Date & Time</button>
</div>
<script>
function displayDateFormats() {
Web Designing Lab (BCA-307) 1323180
const formats = [
{ label: 'Full Date (toString)', value: now.toString() },
{ label: 'Date (toDateString)', value: now.toDateString() },
{ label: 'Time (toTimeString)', value: now.toTimeString() },
{ label: 'ISO String (toISOString)', value: now.toISOString() },
{ label: 'Local Date & Time (toLocalString)', value:
now.toLocaleString() },
{ label: 'Local Date (toLocalDateString)', value:
now.toLocaleDateString() },
{ label: 'Local Time (toLocalTimeString)', value:
now.toLocaleTimeString() },
{ label: 'UTC String (toUTCString)', value: now.toUTCString() },
{ label: 'Custom Date (YYYY-MM-DD)', value:
`${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-
${String(now.getDate()).padStart(2, '0')}` },
{ label: 'Custom Time (HH:MM:SS)', value:
`${String(now.getHours()).padStart(2,
'0')}:${String(now.getMinutes()).padStart(2,
'0')}:${String(now.getSeconds()).padStart(2, '0')}` }
];
formats.forEach(format => {
const div = document.createElement('div');
div.classList.add('date-format');
div.innerHTML = `<span class="label">${format.label}:</span>
<span>${format.value}</span>`;
dateContainer.appendChild(div);
});
}
Output—