Mcss MP
Mcss MP
Mcss MP
MICROPROJECT
Academic year: 2023-24
Place: Vasai
Date: / / 20
Seal of
Institution
Annexure - I
Roll No Individual
Sr. Process Total
Name of Students Presentation
No. and
Product (04) (10)
assessment
(06)
01 1951 Akshay Raul
04
05
06
07
08
09
10
Sr.
Name of resources/Material Specifications Qty Remarks
No.
Processor: i3
1. Computer 1
RAM : 4.00 GB
Access -2007
2. Microsoft Access Software
3. Microsoft Word Word -2007 Software
4. Printer Hp Laser Jet 1
Wikipedia.org
5. Book/Site name
www.envirourment.in
Language(22519)
Roll No: 1951,52,53
Semester: 5th
2 Literature Survey .
Information Collection
3 Completion of the
Target as per project
proposal
4 Analysis of Data and
representation
5 Quality of
Prototype/Model/Conte
nt
6 Report Preparation
(B) Individual Presentation/Viva Out of 4
7 Presentation .
8 Viva
Semester: 5th
The completion of the project would not have been possible without his help and
insights.
INDEX
1
1 What is JavaScript?
4 JavaScript DOM 5
5 Code 6
6 Output 14
7 Conclusion 15
8 Reference 15
What is JavaScript?
1
What is html and CSS?
➢ HTML: -
HTML stands for Hyper Text Markup Language. It is used to
design web pages using a markup language. HTML is the combination of
Hypertext and Markup language. Hypertext defines the link between the
web pages. A markup language is used to define the text document within
tag which defines the structure of web pages.
HTML is a markup language that is used by the browser to
manipulate text, images, and other content to display it in the required
format.
The basic structure of an HTML page is laid out below. It contains
the essential building-block elements (i.e. doctype declaration, HTML,
head, title, and body elements) upon which all web pages are created.
➢ CSS: -
CSS (Cascading Style Sheets) is a stylesheet language used to
design the webpage to make it attractive. The reason for using CSS is to
simplify the process of making web pages presentable. CSS allows you to
apply styles to web pages. More importantly, CSS enables you to do this
independent of the HTML that makes up each web page.
There are three types of CSS which are given below:
o Inline CSS : In Inline CSS, we add the style to the tags
using the “style” attribute inside the tag which we want to
design
2
What are variables, array and functions?
➢ Variables:
Variables are containers for storing data (storing data values).
Var Let
Syntax -: Syntax -:
var name = value; let name = value;
The variables that are defined The variables that are defined
with var statement have with let statement have block
function scope. scope.
We can declare a variable We cannot declare a variable
again even if it has been more than once if we defined
defined previously in the same that previously in the same
scope. scope.
Hoisting is not allowed
Hoisting is allowed with var.
with let.
3
➢ Functions
In JavaScript, functions can be declared using
the function keyword, followed by the function name, and, in
parentheses, the list of parameters (without a var declaration). The
actual function definition is enclosed in curly brackets.
The return keyword is used to return a value or just terminate the
function.
function function-name(parameter-list){
declarations and statements
}
JavaScript also supports anonymous functions: functions without a
name, that can be defined as an expression and stored in a variable.
The variable can then be used as a function name when invoking
the function.
Invoking a function in JavaScript, whether built-in or user-defined,
is the same as in PHP, Java, and other languages: use the name of
the function, followed by the list of arguments (if applicable) in
parentheses.
➢ Arrays
JavaScript arrays can be created using "new Array()", which
creates an empty array, or "new Array(size)", to create an empty
array of given size, or just "[]" for an empty array, or "[1,2,3]" for
an array initialized with 3 integers. The indexes in an array start
with 0.
<script>
var friends = ["Bill", "Doug", "Jim", "Sarah",
"Jill"];
</script>
4
JavaScript DOM
Below are some examples of how you can use the document object to
access and manipulate HTML.
5
Changing HTML Elements
Property Description
Code(html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<link rel="stylesheet" href="style.css">
<title>MCQ Generator</title>
</head>
<body>
<div class="main">
<div id="qb">
<div class="qnb">
<div class="time_box">
<div class="timer_text">Timer</div>
<div id="timer_no">120s</div>
</div>
<div class="qn">
Questions <p id="no">0</p> of <P>10</P>
6
</div>
</div>
<hr>
<div class="question">
<h2 id="que">hii</h2>
</div>
<div class="option" id="opt">
<p class="options" id="a" onclick=check(this)
onmouseover="hover(this)" onmouseout="r_hover(this)"></p>
<p class="options" id="b" onclick=check(this)
onmouseover="hover(this)" onmouseout="r_hover(this)"></p>
<p class="options" id="c" onclick=check(this)
onmouseover="hover(this)" onmouseout="r_hover(this)"></p>
<p class="options" id="d" onclick=check(this)
onmouseover="hover(this)" onmouseout="r_hover(this)"></p>
</div>
<div class="btn">
<button onclick="nxt()" id="nxt">Next</button>
</div>
</div>
<div id="result_box">
<div id="head">Result</div>
<div class="data">
Corrected Ans : <b id="c_ans_no">3</b>
</div>
<div class="data">
Wrong Ans : <b id="w_ans_no">2</b>
</div>
<div class="data">
Attended question : <b id="t_a_no">4</b>
</div>
<div class="data">
Total question : <b id="t_q_no">4</b>
</div>
<div id="bottom">
<button id="restart" onclick="reset()">Restart</button>
</div>
</div>
</div>
<script src="questions.js"></script>
<script src="script.js"></script>
</body>
</html>
7
➢ JavaScript(script.js)
const option = document.getElementsByClassName("options")
const que = document.querySelector("#que");
const result = document.getElementById("result_box")
const qb = document.getElementById("qb")
const num = document.getElementById("no")
var t = 120
var tim;
var que_no = 0;
var correct = 0;
var wrong = 0;
var number = 0
first(que_no);
// timer
interval();
function interval() {
tim = setInterval(time, 1000)
}
function increment() {
number++
num.innerText = number;
}
// reset function
function reset() {
que_no = 0;
correct = 0;
wrong = 0;
t = 120
number = parseInt(num.innerText = 0)
qb.style.display = "block"
result.style.display = "none"
first(que_no);
8
clearInterval(tim);
interval();
}
function first(no) {
que.innerText = question[no].question_no
if (que_no < option.length) {
option_list(no);
for (let i = 0; i < option.length; i++) {
option[i].classList.remove("disable")
option[i].classList.remove("correct")
option[i].classList.remove("incorrect")
}
}
increment();
}
//
// next button
function nxt() {
que_no++;
if (que_no < question.length) {
// this will change the question after click on button;
first(que_no)
option_list(que_no);
for (let i = 0; i < option.length; i++) {
option[i].classList.remove("disable")
option[i].classList.remove("correct")
option[i].classList.remove("incorrect")
}
}
else {
// cal the question end function
question_ends(correct, wrong)
}
}
option[i].innerText = question[que_no].option[i]
}
}
}
9
// check the ans is right or wrong
function check(val) {
var u_ans = val
var selected_option = u_ans.innerText;
if (selected_option == question[que_no].ans) {
u_ans.classList.add("correct");
correct++
}
else {
u_ans.classList.add("incorrect");
for (let i = 0; i < 4; i++) {
if (option[i].innerText == question[que_no].ans) {
option[i].classList.add("correct")
}
}
wrong++
}
for (let j = 0; j < option.length; j++) {
option[j].classList.add("disable")
}
// clearInterval(tim);
// hover functions
function hover(hovers) {
hovers.classList.add("hover")
}
function r_hover(element) {
element.classList.remove("hover");
}
10
➢ JavaScript(questions.js)
const question = [
{
question_no: "HTML is what type of language?",
ans: "Markup Language",
option: [
"Macro Language",
"Programming Language",
"Markup Language",
"Scripting Language"
]
},
{
question_no: "What amount of bits commonly equals one byte?",
ans: "8",
option: [
"8",
"1",
"64",
"2"
]
},
{
question_no: "What port does HTTP run on?",
ans: "80",
option: [
"23",
"53",
"443",
"80"
]
},
{
question_no: "What is the Roman numeral for 500?",
ans: "D",
option: [
"L",
"C",
11
"X",
"D"
]
},
{
question_no: "What is the alphanumeric representation of the
imaginary number?",
ans: "i",
option: [
"e",
"i",
"n",
"x"
]
},
{
question_no: "Which team won 2014 FIFA World Cup in Brazil?",
ans: "Germany",
option: [
"Germany",
"Netherlands",
"Brazil",
"Argentina"
]
},
{
question_no: "Which country has hosted the 2020 Summer
Olympics?",
ans: "Japan",
option: [
"China",
"Australia",
"Japan",
"Germany"
]
},
{
question_no: "How many dots are on a single die?",
ans: "21",
option: [
"21",
"15",
"24",
"18"
12
]
},
{
question_no: "In Chess, the Queen has the combined movement of
which two pieces?",
ans: "Bishop and Rook",
option: [
"Rook and King",
"Knight and Bishop",
"King and Knight",
"Bishop and Rook"
]
},
{
question_no: "The collapse of the Soviet Union took place in
which year?",
ans: "1991",
option: [
"1891",
"1991",
"1992",
"1990"
]
},
];
13
Output
14
Conclusion
We have study the basic of JavaScript concepts like how to access the
elements in JavaScript and how to add or remove the class of CSS on click.
The JavaScript is object-oriented language. We use the oops connects like
functions, object, and the in-built function of JavaScript like clearInterval (),
setInterval () etc…
The main thing in this project we understand how to use the DOM of
JavaScript to handle the events.
Reference
www.geeksforgeeks.org
JavaScript - Wikipedia
15