NIELIT O Level M2-R5.1 Practical Programs with Solutions – Complete HTML, CSS & JavaScript Guide
📚 Table of Contents
Complete NIELIT O Level M2-R5.1 practical solution guide covering HTML, forms, lists, hyperlinks, frames, tables, CSS, JavaScript and AngularJS with easy-to-understand programs and examples.
📌 Quick Summary
NIELIT O Level M2-R5.1 Practical Programs with Solutions Are you preparing for the NIELIT O Level M2-R5.1 Web Designing and Publishing practica...
This article is written for beginners who want to learn and build a career in NIELIT O Level M2-R5.1 Practical Programs with Solutions – Complete HTML, CSS & JavaScript Guide.
NIELIT O Level M2-R5.1 Practical Programs with Solutions
Are you preparing for the NIELIT O Level M2-R5.1 Web Designing and Publishing practical examination? This complete practical guide is designed to help students understand and perform important HTML, CSS, JavaScript and AngularJS programs.
The practical exercises in this guide follow the NIELIT O Level IT syllabus revision 5.1, including the exercises listed on pages 41 and 42 of the syllabus material provided for this guide.
Each practical includes a question, program code and explanation so that students can practise independently using a text editor and web browser.
Table of Contents
- Basic HTML Page with Heading and Paragraphs
- HTML Personal Information Form
- HTML Ordered List
- Anchor Tag and Hyperlinks
- City Information Web Page
- Seven Lines in Different Colours
- Polynomial Expression Using HTML
- HTML Frames Layout
- Warning Message with Blinking Effect
- Hello World in Bold and Italic
- Image Removal on Mouse Click
- Simple Interest Using JavaScript
- Hyperlink to Google
- Left, Right and Center Aligned Images
- HTML Table with Rowspan and Colspan
- Four Frames Using HTML
- CSS Background Shorthand Property
- Prime Number Series Using JavaScript
- Display Current Day and Time
- Sum and Multiplication of Two Numbers
- Redirect, Popup and Print in JavaScript
- Hello World Application in AngularJS
- Event Registration Page with Libraries
- Display AngularJS in Text and Textbox
- Registration Form with JavaScript Validation
Practical 1: Create an HTML Page with a Heading and Two Paragraphs
Question: Create an HTML file (for example, first_page.html) that specifies a page containing a heading and two paragraphs of text.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to KAiSH Computer Institute</h1>
<p>HTML stands for HyperText Markup Language.
It is used to create web pages.</p>
<p>HTML provides different tags to structure
headings, paragraphs, images and links.</p>
</body>
</html>
Explanation
<h1>defines the main heading.<p>defines a paragraph.<title>defines the browser tab title.<body>contains visible page content.
Practical 2: Create a Personal Information Form
Question: Design an HTML form that allows a user to enter personal data using text fields, password fields, email fields, lists, radio buttons, checkboxes and a submit button.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Personal Information Form</title>
</head>
<body>
<h2>Personal Information Form</h2>
<form>
Name:
<input type="text" name="name" required>
<br><br>
Email:
<input type="email" name="email" required>
<br><br>
Password:
<input type="password" name="password">
<br><br>
Gender:
<input type="radio" name="gender" value="Male"> Male
<input type="radio" name="gender" value="Female"> Female
<br><br>
Qualification:
<select name="qualification">
<option>Select Qualification</option>
<option>High School</option>
<option>Intermediate</option>
<option>Graduation</option>
</select>
<br><br>
Skills:
<input type="checkbox" name="skill" value="HTML"> HTML
<input type="checkbox" name="skill" value="CSS"> CSS
<input type="checkbox" name="skill" value="JavaScript"> JavaScript
<br><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>
Important HTML Form Elements
| Element | Purpose |
|---|---|
| text | Accepts text input |
| password | Accepts hidden password input |
| Accepts email address | |
| radio | Selects one option from a group |
| checkbox | Selects multiple options |
| select | Creates a dropdown list |
| submit | Submits the form |
| reset | Resets form fields |
Practical 3: Create an Ordered List in HTML
Question: Write HTML code to generate the following output:
- Coffee
- Tea
- Black Tea
- Green Tea
- Milk
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Ordered List</title>
</head>
<body>
<h2>Beverages</h2>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Black Tea</li>
<li>Green Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output: A numbered list containing five beverage names.
Practical 4: Demonstrate the Anchor Tag
Question: Create hyperlinks that open in a new window, the same window, reference a location within the same document, link to an image and make an image clickable.
A. Open a Link in a New Tab
<a href="https://www.google.com"
target="_blank"
rel="noopener">
Open Google in New Tab
</a>
B. Open a Link in the Same Window
<a href="https://www.google.com"
target="_self">
Open Google in Same Window
</a>
C. Create an Internal Page Link
<a href="#about">Go to About Section</a>
<h2 id="about">About Us</h2>
<p>Welcome to our website.</p>
D. Create a Link to an Image
<a href="student.jpg" target="_blank">
View Student Image
</a>
E. Make an Image a Hyperlink
<a href="https://www.google.com"
target="_blank" rel="noopener">
<img src="student.jpg"
alt="Student Image" width="200">
</a>
Practical 5: Create a City Information Web Page
Question: Create an HTML page about your city. Display the city name at the top in large blue text. Add landmark names using different colours, styles and typefaces. Make one landmark name blink and add scrolling text.
HTML and CSS Program
<!DOCTYPE html>
<html>
<head>
<title>My City</title>
<style>
body {
font-family: Arial;
background-color: #f0f8ff;
}
h1 {
color: blue;
font-size: 45px;
text-align: center;
}
.landmark1 {
color: red;
font-family: Georgia;
}
.landmark2 {
color: green;
font-family: Arial;
}
.landmark3 {
color: purple;
font-family: Verdana;
}
.blink {
animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
to { visibility: hidden; }
}
.message {
color: white;
background: #173c85;
padding: 10px;
white-space: nowrap;
overflow: hidden;
}
.message span {
display: inline-block;
animation: scroll 10s linear infinite;
}
@keyframes scroll {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
</head>
<body>
<h1>Lucknow</h1>
<h2 class="landmark1">Bara Imambara</h2>
<h2 class="landmark2">Rumi Darwaza</h2>
<h2 class="landmark3 blink">University of Lucknow</h2>
<div class="message">
<span>Welcome to the City of Nawabs!</span>
</div>
</body>
</html>
Note: CSS animation is used for blinking and scrolling effects instead of obsolete HTML blink and marquee elements.
Practical 6: Display Seven Lines in Different Colours
Question: Create an HTML page with seven separate lines in different colours. State the colour of each line in its text.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Seven Colours</title>
</head>
<body>
<p style="color:red">This is Red Colour</p>
<p style="color:blue">This is Blue Colour</p>
<p style="color:green">This is Green Colour</p>
<p style="color:orange">This is Orange Colour</p>
<p style="color:purple">This is Purple Colour</p>
<p style="color:brown">This is Brown Colour</p>
<p style="color:magenta">This is Magenta Colour</p>
</body>
</html>
Practical 7: Display a Polynomial Expression
Question: Create an HTML page containing the polynomial expression:
a0 + a1x + a2x2 + a3x3
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Polynomial Expression</title>
</head>
<body>
<h2>Polynomial Expression</h2>
<p>
a<sup>0</sup> +
a<sup>1</sup>x +
a<sup>2</sup>x<sup>2</sup> +
a<sup>3</sup>x<sup>3</sup>
</p>
</body>
</html>
Practical 8: Create an HTML Frame Layout
Question: Generate a page divided into six sections with the following headings:
- First Frame: Name and Address
- Second Frame: Bulleted List of Qualifications
- Third Frame: Links to Favourite Sites
- Fourth Frame: Scrolling Message
- Fifth Frame: Blinking Reminders
- Sixth Frame: Image
HTML Program Using CSS Grid
<!DOCTYPE html>
<html>
<head>
<title>Six Section Layout</title>
<style>
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 3px;
background: #fff;
}
.frame {
background: #ffe0d8;
padding: 20px;
border: 1px solid white;
min-height: 100px;
}
.first {
grid-column: 1 / 4;
background: #ff8500;
}
.second {
grid-column: 1 / 2;
}
.third {
grid-column: 2 / 4;
}
.blink {
animation: blink 1s steps(2,start) infinite;
}
@keyframes blink {
to { visibility: hidden; }
}
.scroll {
white-space: nowrap;
overflow: hidden;
}
.scroll span {
display: inline-block;
animation: move 8s linear infinite;
}
@keyframes move {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
</head>
<body>
<div class="container">
<div class="frame first">
<b>First Frame: Name and Address</b>
<p>Name: Rahul Kumar</p>
<p>Address: Lucknow</p>
</div>
<div class="frame second">
<b>Second Frame: Qualifications</b>
<ul>
<li>High School</li>
<li>Intermediate</li>
<li>Graduation</li>
</ul>
</div>
<div class="frame third">
<b>Third Frame: Favourite Sites</b>
<p>
<a href="https://www.google.com">Google</a><br>
<a href="https://www.youtube.com">YouTube</a>
</p>
</div>
<div class="frame">
<b>Fourth Frame: Scrolling Message</b>
<div class="scroll">
<span>Welcome to my webpage!</span>
</div>
</div>
<div class="frame">
<b>Fifth Frame: Reminders</b>
<p class="blink">Complete your practical work!</p>
</div>
<div class="frame">
<b>Sixth Frame: Image</b>
<img src="student.jpg" width="100" alt="Student">
</div>
</div>
</body>
</html>
Note: This solution recreates the six-section visual layout using CSS Grid. It is not a legacy HTML frameset implementation.
Practical 9: Create a Red Warning Page with Blinking Text
Question: Create an HTML page with a red background and a large blinking warning message. Add scrolling text saying "Read the message" below it.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Warning Page</title>
<style>
body {
background-color: red;
color: white;
text-align: center;
}
.warning {
font-size: 60px;
font-weight: bold;
animation: blink 1s steps(2,start) infinite;
}
@keyframes blink {
to { visibility: hidden; }
}
.scroll {
overflow: hidden;
white-space: nowrap;
font-size: 30px;
}
.scroll span {
display: inline-block;
animation: move 7s linear infinite;
}
@keyframes move {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
</head>
<body>
<h1 class="warning">WARNING</h1>
<div class="scroll">
<span>Read the message below!</span>
</div>
</body>
</html>
Practical 10: Print Hello World in Bold and Italic
Question: Write an HTML page to print Hello World in bold and italic form.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>
<b><i>Hello World</i></b>
</p>
</body>
</html>
Practical 11: Display and Remove an Image on Mouse Click
Question: Design an HTML page to display a picture. The picture should be removed from the screen after a mouse click on it.
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Remove Image</title>
</head>
<body>
<h2>Click the Image to Remove It</h2>
<img id="photo"
src="student.jpg"
width="300"
alt="Click to remove"
onclick="removeImage()">
<script>
function removeImage() {
document.getElementById("photo").remove();
}
</script>
</body>
</html>
Practical 12: Calculate Simple Interest Using JavaScript
Question: Create an HTML document with three textboxes and a button. Accept principal, rate of interest and duration in years. On clicking OK, display the simple interest amount.
Formula: Simple Interest = (Principal × Rate × Time) / 100
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Simple Interest Calculator</title>
</head>
<body>
<h2>Simple Interest Calculator</h2>
Principal:
<input type="number" id="p">
<br><br>
Rate of Interest:
<input type="number" id="r" step="any">
<br><br>
Duration (Years):
<input type="number" id="t" step="any">
<br><br>
<button onclick="calculate()">OK</button>
<h3 id="result"></h3>
<script>
function calculate() {
let p = Number(document.getElementById("p").value);
let r = Number(document.getElementById("r").value);
let t = Number(document.getElementById("t").value);
if (p <= 0 || r < 0 || t <= 0) {
alert("Enter valid values");
return;
}
let si = (p * r * t) / 100;
document.getElementById("result").innerHTML =
"Simple Interest = " + si.toFixed(2);
}
</script>
</body>
</html>
Practical 13: Create a Hyperlink to Google
Question: Create an HTML hyperlink which opens www.google.com in a new window or tab.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Google Hyperlink</title>
</head>
<body>
<a href="https://www.google.com"
target="_blank"
rel="noopener">
Click Here to Open Google
</a>
</body>
</html>
Practical 14: Display Three Images at Left, Right and Center
Question: Create an HTML file that displays three images at LEFT, RIGHT and CENTER respectively in the browser.
HTML and CSS Program
<!DOCTYPE html>
<html>
<head>
<title>Image Alignment</title>
<style>
.left {
float: left;
}
.right {
float: right;
}
.center {
display: block;
margin: 20px auto;
clear: both;
}
</style>
</head>
<body>
<h2>Image Alignment Example</h2>
<img src="image1.jpg" width="150"
class="left" alt="Left Image">
<img src="image2.jpg" width="150"
class="right" alt="Right Image">
<img src="image3.jpg" width="150"
class="center" alt="Center Image">
</body>
</html>
Practical 15: Create an HTML Table Using Rowspan and Colspan
Question: Create a timetable using ROWSPAN and COLSPAN attributes. Include CELLSPACING and CELL PADDING.
HTML Program
<!DOCTYPE html>
<html>
<head>
<title>Class Timetable</title>
</head>
<body>
<h2>Class Timetable</h2>
<table border="1"
cellspacing="5"
cellpadding="12">
<tr>
<th>Day</th>
<th>9 AM</th>
<th>10 AM</th>
<th>11 AM</th>
<th>12 PM</th>
</tr>
<tr>
<td>Monday</td>
<td>HTML</td>
<td colspan="2">CSS Practical</td>
<td>JavaScript</td>
</tr>
<tr>
<td>Tuesday</td>
<td rowspan="2">Python</td>
<td>HTML</td>
<td>CSS</td>
<td>JavaScript</td>
</tr>
<tr>
<td>Wednesday</td>
<td>PHP</td>
<td>SQL</td>
<td>Project</td>
</tr>
</table>
</body>
</html>
Important Attributes
- ROWSPAN: Merges two or more rows vertically.
- COLSPAN: Merges two or more columns horizontally.
- CELLSPACING: Specifies spacing between table cells in traditional HTML tables.
- CELLPADDING: Specifies spacing between cell content and cell border.
Practical 16: Create a Four-Frame Web Page
Question: Divide the web page into four frames. In one frame create three links which display different HTML forms in the remaining three frames.
Note: The following example uses the traditional HTML frameset technique requested in the syllabus. Frameset is obsolete in modern HTML, but it is useful for understanding this legacy practical.
File 1: index.html
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Four Frames</title>
</head>
<frameset rows="20%,80%">
<frame src="header.html">
<frameset cols="25%,75%">
<frame src="menu.html" name="menu">
<frame src="home.html" name="content">
</frameset>
</frameset>
</html>
File 2: menu.html
<html>
<body>
<h3>Menu</h3>
<a href="form1.html" target="content">
Form 1</a><br>
<a href="form2.html" target="content">
Form 2</a><br>
<a href="form3.html" target="content">
Form 3</a>
</body>
</html>
File 3: header.html
<html>
<body bgcolor="lightblue">
<h2 align="center">My Website</h2>
</body>
</html>
File 4: home.html
<html>
<body>
<h2>Welcome</h2>
<p>Select a form from the menu.</p>
</body>
</html>
File 5: form1.html
<html>
<body>
<h2>Personal Form</h2>
<input type="text" placeholder="Enter Name">
</body>
</html>
File 6: form2.html
<html>
<body>
<h2>Contact Form</h2>
<input type="email" placeholder="Enter Email">
</body>
</html>
File 7: form3.html
<html>
<body>
<h2>Feedback Form</h2>
<textarea placeholder="Enter Feedback"></textarea>
</body>
</html>
Practical 17: Set Background Image Using CSS Shorthand Property
Question: Use CSS shorthand background property to set a background image, display it only once and position it in the top-right corner.
HTML and CSS Program
<!DOCTYPE html>
<html>
<head>
<title>Background Image</title>
<style>
body {
background: url("xyz.png")
no-repeat
right top;
background-size: 180px;
}
</style>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This page has a background image.</p>
</body>
</html>
Practical 18: Generate Prime Numbers Using JavaScript
Question: Write a JavaScript program to generate a series of prime numbers.
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Prime Number Series</title>
</head>
<body>
<h2>Prime Numbers</h2>
Enter Limit:
<input type="number" id="limit" min="2">
<button onclick="generatePrime()">
Generate
</button>
<p id="output"></p>
<script>
function generatePrime() {
let n = Number(document.getElementById("limit").value);
let result = [];
if (!Number.isInteger(n) || n < 2) {
document.getElementById("output").innerHTML =
"Enter a valid limit of 2 or more.";
return;
}
for (let i = 2; i <= n; i++) {
let prime = true;
for (let j = 2; j * j <= i; j++) {
if (i % j === 0) {
prime = false;
break;
}
}
if (prime) {
result.push(i);
}
}
document.getElementById("output").innerHTML =
"Prime Numbers: " + result.join(", ");
}
</script>
</body>
</html>
Practical 19: Display Current Day and Time Using JavaScript
Question: Write a JavaScript program to display the current day and time in the following format.
Sample Output:
Today is: Friday.
Current time is: 10 AM: 30:38
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Current Date and Time</title>
</head>
<body>
<h2 id="day"></h2>
<h2 id="time"></h2>
<script>
function showDateTime() {
let now = new Date();
let days = [
"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday",
"Saturday"
];
let day = days[now.getDay()];
let hours = now.getHours();
let ampm = hours >= 12 ? "PM" : "AM";
hours = hours % 12 || 12;
let minutes = String(now.getMinutes()).padStart(2,"0");
let seconds = String(now.getSeconds()).padStart(2,"0");
document.getElementById("day").innerHTML =
"Today is: " + day + ".";
document.getElementById("time").innerHTML =
"Current time is: " + hours + " " + ampm +
": " + minutes + ":" + seconds;
}
showDateTime();
setInterval(showDateTime,1000);
</script>
</body>
</html>
Practical 20: Find Sum and Multiplication of Two Numbers
Question: Write a JavaScript program to calculate the sum and multiplication of two numbers.
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Sum and Multiplication</title>
</head>
<body>
<h2>Number Calculator</h2>
Enter First Number:
<input type="number" id="num1">
<br><br>
Enter Second Number:
<input type="number" id="num2">
<br><br>
<button onclick="calculate()">
Calculate
</button>
<h3 id="result"></h3>
<script>
function calculate() {
let a = Number(document.getElementById("num1").value);
let b = Number(document.getElementById("num2").value);
let sum = a + b;
let multiplication = a * b;
document.getElementById("result").innerHTML =
"Sum = " + sum +
"<br>Multiplication = " + multiplication;
}
</script>
</body>
</html>
Practical 21: Redirect, Popup and Print Functions in JavaScript
Question: Write a JavaScript program to demonstrate redirection, popup and print functions.
HTML and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Functions</title>
</head>
<body>
<h2>JavaScript Demonstration</h2>
<button onclick="popup()">Popup</button>
<button onclick="redirect()">Redirect</button>
<button onclick="window.print()">Print Page</button>
<script>
function popup() {
alert("Welcome to JavaScript!");
}
function redirect() {
window.location.href = "https://www.google.com";
}
</script>
</body>
</html>
Practical 22: Create Your First Hello World Application in AngularJS
Question: Create your first Hello World application using AngularJS.
HTML Program
<!DOCTYPE html>
<html ng-app="">
<head>
<title>AngularJS Hello World</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
</head>
<body>
<h2>{{ "Hello World" }}</h2>
</body>
</html>
Explanation
- ng-app: Defines the AngularJS application.
- {{ }}: Displays an AngularJS expression.
- AngularJS: A JavaScript framework for dynamic web applications.
Practical 23: Create an Event Registration Page Using Important Libraries
Question: Create an HTML page with the title Event Registration and references to Bootstrap, jQuery and AngularJS.
HTML Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<title>Event Registration</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
</head>
<body class="container mt-5">
<h2>Event Registration Form</h2>
<form>
<div class="mb-3">
<label>Name</label>
<input type="text" class="form-control"
placeholder="Enter Name">
</div>
<div class="mb-3">
<label>Email</label>
<input type="email" class="form-control"
placeholder="Enter Email">
</div>
<button type="submit" class="btn btn-primary">
Register
</button>
</form>
<script>
$(document).ready(function() {
console.log("jQuery Loaded");
});
</script>
</body>
</html>
Practical 24: Display AngularJS in Text Format and Textbox
Question: Write code to display the words AngularJS in both text format and in a textbox when the page is viewed in the browser.
HTML and AngularJS Program
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>AngularJS Text Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
</head>
<body ng-controller="myCtrl">
<h2>{{message}}</h2>
<input type="text" ng-model="message">
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.message = "AngularJS";
});
</script>
</body>
</html>
Practical 25: Registration Form with JavaScript Validation
Question: Create a sample registration form that collects first name, last name, email, user ID, password and confirm password.
All inputs are mandatory. The email must be in a correct format. Password and confirm password must match. JavaScript should display error messages in red colour next to the respective fields.
Complete HTML, CSS and JavaScript Program
<!DOCTYPE html>
<html>
<head>
<title>Registration Form Validation</title>
<style>
body {
font-family: Arial;
background: #f2f5fb;
}
form {
background: white;
padding: 25px;
max-width: 450px;
margin: 30px auto;
border-radius: 10px;
}
input {
width: 100%;
padding: 10px;
margin: 7px 0;
box-sizing: border-box;
}
.error {
color: red;
font-size: 13px;
}
button {
background: #173c85;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<form id="registrationForm">
<h2>Student Registration</h2>
<label>First Name</label>
<input type="text" id="fname">
<span class="error" id="fnameError"></span>
<label>Last Name</label>
<input type="text" id="lname">
<span class="error" id="lnameError"></span>
<label>Email</label>
<input type="text" id="email">
<span class="error" id="emailError"></span>
<label>User ID</label>
<input type="text" id="userid">
<span class="error" id="useridError"></span>
<label>Password</label>
<input type="password" id="password">
<span class="error" id="passwordError"></span>
<label>Confirm Password</label>
<input type="password" id="confirm">
<span class="error" id="confirmError"></span>
<br><br>
<button type="submit">Register</button>
<p id="success" style="color:green"></p>
</form>
<script>
document.getElementById("registrationForm")
.addEventListener("submit", function(event) {
event.preventDefault();
let fields = [
"fname", "lname", "email",
"userid", "password", "confirm"
];
fields.forEach(function(id) {
document.getElementById(id + "Error").innerHTML = "";
});
document.getElementById("success").innerHTML = "";
let fname = document.getElementById("fname").value.trim();
let lname = document.getElementById("lname").value.trim();
let email = document.getElementById("email").value.trim();
let userid = document.getElementById("userid").value.trim();
let password = document.getElementById("password").value;
let confirm = document.getElementById("confirm").value;
let valid = true;
if (fname === "") {
document.getElementById("fnameError").innerHTML =
"First name is required";
valid = false;
}
if (lname === "") {
document.getElementById("lnameError").innerHTML =
"Last name is required";
valid = false;
}
let emailPattern =
/^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (email === "") {
document.getElementById("emailError").innerHTML =
"Email is required";
valid = false;
}
else if (!emailPattern.test(email)) {
document.getElementById("emailError").innerHTML =
"Enter a valid email address";
valid = false;
}
if (userid === "") {
document.getElementById("useridError").innerHTML =
"User ID is required";
valid = false;
}
if (password === "") {
document.getElementById("passwordError").innerHTML =
"Password is required";
valid = false;
}
if (confirm === "") {
document.getElementById("confirmError").innerHTML =
"Confirm password is required";
valid = false;
}
else if (password !== confirm) {
document.getElementById("confirmError").innerHTML =
"Passwords do not match";
valid = false;
}
if (valid) {
document.getElementById("success").innerHTML =
"Registration form validated successfully!";
}
});
</script>
</body>
</html>
Important Concepts to Revise for M2-R5.1 Practical Examination
| Technology | Important Topics |
|---|---|
| HTML | Headings, paragraphs, forms, lists, links, images and tables |
| CSS | Colours, fonts, backgrounds, animations and layouts |
| JavaScript | Variables, functions, events, conditions, loops and DOM |
| AngularJS | ng-app, ng-model, ng-controller and expressions |
| Bootstrap | CDN, containers, forms, buttons and responsive design |
| jQuery | Library inclusion and document.ready() |
Practical Examination Preparation Tips
- Practise writing HTML documents without copying and pasting.
- Understand the purpose of every HTML tag and attribute.
- Practise CSS properties and their values.
- Learn JavaScript variables, loops, functions and events.
- Practise form validation and DOM manipulation.
- Understand how to include external libraries.
- Save files with the correct .html extension.
- Run every program in a browser and verify the output.
- Keep separate folders for images, CSS and JavaScript files.
Practise NIELIT O Level M2-R5.1 with KAiSH Computer Institute, Lucknow
Understanding concepts is important, but regular practical implementation is equally important for becoming confident in Web Designing and Publishing.
KAiSH Computer Institute provides practical-oriented computer training with a focus on programming concepts, hands-on assignments and skill development.
Why Learn at KAiSH?
- Trusted Computer Training Institute Since 2013
- ISO 9001:2015 Certified
- Practical-oriented learning
- Small batches and individual attention
- Experienced faculty guidance
- Programming and web development practice
Director: Er. Kamlesh Tripathi
Institute: KAiSH Computer Institute, Aliganj, Lucknow
Call / WhatsApp: 7348033936
Website: www.kaishclasses.com
Where Futures Are Coded.
Frequently Asked Questions – O Level M2-R5.1
1. What is M2-R5.1 in NIELIT O Level?
M2-R5.1 is the Web Designing and Publishing module of the NIELIT O Level course.
2. Which programming languages are used in M2-R5.1 practicals?
The practical exercises covered in this guide use HTML, CSS, JavaScript and AngularJS, along with Bootstrap and jQuery library references.
3. Are these programs useful for O Level practical preparation?
Yes. These programs provide worked solutions to the practical exercises visible in the supplied syllabus pages 41 and 42.
4. Can I practise these programs in Notepad?
Yes. You can write HTML, CSS and JavaScript code in Notepad or any suitable code editor, save the file with an .html extension and open it in a browser.
5. How can I prepare for the M2-R5.1 practical examination?
Practise each program, understand its output, revise HTML tags, CSS properties and JavaScript functions, and perform the programs independently.
6. Where can I learn O Level Web Designing in Lucknow?
Students can explore practical-oriented NIELIT O Level training at KAiSH Computer Institute, Aliganj, Lucknow.
Official Learning Resources
- HTML Documentation – MDN
- CSS Documentation – MDN
- JavaScript Documentation – MDN
- Bootstrap Documentation
- jQuery Documentation
- AngularJS Documentation
- NIELIT Official Website
Disclaimer: This is an educational practical solution guide prepared using the supplied NIELIT O Level M2-R5.1 syllabus exercise pages. Students should refer to the latest official NIELIT syllabus and examination instructions for final preparation.
🔗 Related Articles
https://www.kaishclasses.com/best-nielit-o-level-institute-lucknow.php https://www.kaishclasses.com/online-exam👉 Want to start your career? Join KAiSH Computer Institute today.