Professional Documents
Culture Documents
Operators
Logical
Take two variables and store values in them
check all the logical operators and display proper
outputs.
ANS-
<html>
<body>
<script type="text/javascript">
//Take two variables and store values in them
//check all the logical operators and display proper outputs
var x=10 ;
var y=20;
var z=30;
var res1= x<y && x>z;
var res2= x<y || x>z;
var res3= !(x == y)&& !(x == z)&& !(y == z)
</html>
Comparison Operators
Take two variables and store values in them
check all the comparison operators and display
proper outputs
ANS-
<html>
<body>
<script type="text/javascript">
//Take two variables and store values in them
//check all the comparison operators and display proper outputs
x=10,y=20;
document.write("<h1>Comparison Operators</h1>");
document.write("For the number " + x +" and " + y +" the value of > is " + (x
> y) + "<br>");
document.write("For the number " + x +" and " + y +" the value of < is " + (x
< y) + "<br>");
document.write("For the number " + x +" and " + y +" the value of <= is " +
(x <= y) + "<br>");
50
</script>
</body>
</html>
Arithmetic Operators
Accept two numbers in two variables and display all
mathematical operations
<html>
<body>
<script type="text/javascript">
//Accept two numbers in two variables and display all mathematical
operations
x=10,y=20;
sum= x + y;
sub=x - y;
div=x/y;
mult=x*y;
mod=x%y;
51
Object
<html>
<script>
car = { type: "porsche" , color:"grey" , model :"911"}
car.type= "ferrari".
document.write (car.type)
</script>
</html>
House Image
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<h1>HOUSES</h1>
<div class="cube-container">
<div class="cube initial-position">
<img class="cube-face-image image-1" src="agni.jpeg" width="300px"
height="300px">
<img class="cube-face-image image-2" src="jal.png" width="300px"
height="300px">
<img class="cube-face-image image-3" src="prithvi.jpg" width="300px"
height="300px">
<img class="cube-face-image image-4" src="vayu.jpeg" width="300px"
height="300px">
<img class="cube-face-image image-5" src="house.jpeg" width="300px"
height="300px">
<img class="cube-face-image image-6" src="lsa.tiff" width="300px"
height="300px">
</div>
</div>
<h2>Click the images below to rotate the cube</h2>
<div class="image-buttons">
53
<HTML>
<TITLE>Playing with Data Types</TITLE> <BODY>
<script type="text/javascript">
var num1=parselnt(prompt("Enter the first number")); var
num2=parseFloat(prompt("Enter the second number")
document.write("<BR>The first number is: " + num1);
document.write("<BR>The second number is: " + num21
document.write("<BR>The sum is: " + eval("num1+num2"))
document.write("<BR>The statement result is not a number is:
"+isNaN(eval("num1-num2")
// (i) What type of value will be stored in numl and num2 ?
/(ii) Give the output of the above code if the values input by the user are
20.5 and 23.5 K/SCRIPT>
</BODY>
</HTML>
Radio Checked
<HTML><head><TITLE>Stream</TITLE></head> <BODY>
58
Honouring the father of the Library Movement, the late P.N. Panicker, 19th
June is being celebrated as Reading Day. The 28th National Reading Day
will be celebrated on 19th June 2023, and Reading Month will be celebrated
from 19th June to 18th July 2023.
https://cbseacademic.nic.in/web_material/Circulars/2023/68_Circular_2023.
pdf
To Do:-
Imagine, your academy is organizing loads of activities during for the above
mentioned cause.
i. Using HTML and JavaScript, create a webpage for the same with brief
introduction stating importance of book reading along with a participation
form.
ii. Apply JS/HTML events. Minimum required event numbers are mentioned.
(Mouse Event 2, KeyBoard event 1,Form Event 2, Window/ Document
Event 1). You can explore beyond it too.
iii. Proper display messages/ guided messages must be there for
showcasing the event handlings.
iv. Save your file with proper naming format.
v. Upload within given date.
<!DOCTYPE html>
<html>
<head>
<title>Book Reading Importance</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
60
h1 {
color: #333;
font-size: 24px;
}
p{
color: #666;
font-size: 16px;
line-height: 1.5;
}
form {
margin-top: 20px;
}
input[type="text"], textarea {
width: 300px;
padding: 5px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #333;
color: #fff;
border: none;
cursor: pointer;
}
#output {
margin-top: 20px;
color: #333;
font-size: 16px;
}
</style>
61
</head>
<body>
<h1>Importance of Book Reading</h1>
<p id="introParagraph">Reading books is a great way to expand
knowledge, improve vocabulary, and stimulate the mind. It enhances
creativity and imagination, helps in personal growth, and provides a means
of relaxation and escape from daily stresses.</p>
<form id="participationForm">
<h2>Participation Form</h2>
<label for="name">Name:</label>
<input type="text" id="name" required><br>
<label for="email">Email:</label>
<input type="text" id="email" required><br>
<label for="message">Message:</label>
<textarea id="message" required></textarea><br>
<input type="submit" id="submitButton" value="Submit">
</form>
<div id="output"></div>
<script>
// Mouse Event 1: Click event on the Submit button
var submitBtn = document.getElementById('submitButton');
submitBtn.addEventListener('click', function(event) {
event.preventDefault();
displayMessage('Form submitted!');
});
function displayMessage(message) {
var output = document.getElementById('output');
output.innerHTML = message;
}
</script>
</body>
</html>
64
JS -MCQs
65
66
67
Array Object
Displaying Array
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<p id="frt"></p>
<p id="p1"></p>
<p id="p3"></p>
<p id="p4"></p>
<p id="p5"></p>
<script>
//To a Method
const cars = ["Toyota", "Tata", "Maruti Suzuki", "BMW"];
document.getElementById("demo").innerHTML = cars.toString();
//join
const fruit = ["Apple", "Mango", "Orange", "Banana"];
document.getElementById("frt").innerHTML = fruit.join(" * ");
//pop
const fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("p1").innerHTML = fruits;
fruits.pop();
document.getElementById("p3").innerHTML = fruits;
//push
const frui = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("p4").innerHTML = frui;
68
frui.push("Kiwi");
document.getElementById("p5").innerHTML = frui;
</script>
</body>
</html>
<html>
<script>
//create an array of n elements and rotate clockwise and anticlockwise
const a=[]
var n=parseInt(prompt("enter a limit"));
var m=parseInt(prompt("Enter rotation"));
for (i=0;i<n;i++)
{
69
</script> </html>
70
<!DOCTYPE html>
<html>
<body>
<script>
// SORTING ARRAYS in words
const a = [];
var n = parseInt(prompt("Enter a limit"));
for (let i = 0; i < n; i++) {
ele = prompt("Enter any word");
a.push(ele);
}
a.sort();
document.write(a.join(", "));
</script>
</body>
</html>
71
72
</script>
</html>
73
</script>
</html>
75
Displaying N Elements-Array
<html>
<script>
// taking limit of array and displaying elements taking from user
const a=[]
var n=parseInt(prompt("enter a limit"));
for (i=0;i<n;i++)
{
ete=parseInt(prompt("Enter any number"));
a.push(ete)
document.write("<BR>" + a[i])
}
</script>
</html>
76
77
Math Object
Q) Take a decimal number from user and display the following-
A-It's nearest integer value
B-It's greatest or equal integer value
C-It's less or equal integer value
<html>
<body>
<script type="text/javascript">
//Take a decimal number from user and display the following-
//A-It's nearest integer value
//B-It's greatest or equal integer value
//C-It's less or equal integer value
var n1=parseFloat(prompt("Enter any number"));
rd=Math.round(n1);
ce=Math.ceil(n1);
fl=Math.floor(n1);
document.write("The nearest integer value is"+ rd);
document.write("<br>The greater or equal integer is"+ ce);
document.write("<br>The lesser or equal integer value is"+ fl);
</script>
</body>
</html>
78
Loops
For loop
<!DOCTYPE html>
<html>
<body>
<h1>list of odd numbers fromm 11 to 50</h1>
<p> For loop</p>
<script>
//WAP to get a list of odd numbers fromm 11 to 50
var i=11;
for (; i < 50; i+=2) {
document.write(i+"<BR>"); }
</script>
</body>
</html>
79
While loop
<html>
<body>
<h1>square using while loop</h1>
<script>
//WAP TO ACCEPT A NUMBER FROM THE USER AND DISPLAY THE
SQUARES OF THE NUMBERS REPETITIVELY TILL 8 ENTRIES
var k=1;
80
Do While loop
<html>
<script>
//WAP to accept age from user and display the age . and wait another year
until age=18
var age=parseInt(prompt("Enter Age"));
do
{
document.write("Your Age is " + age + "<br>")
age++;
if(age<18)
{
document.write("Wait Another Year")
}
}
while(age<18)
</script>
</html>
82
CSS
CODE:
<!DOCTYPE html
PUBLIC
"-//W3C//DTD
XHTML
1.0
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
xmIns="http://www.w3.org/1999/xhtm|">
<!-- #BeginTemplate "test.dwt" --> <head>
<meta content="en-in" http-equiv="Content Language" /> <meta
content="text/html; charset=utf-8" http-equiv="Content-Type" />
<!-- #BeginEditable "doctitle" .-> <title>WELCOME TO GOOGLE</title>
<style type="text/css">
auto-style1 {
text-align: right;
Transitional//EN"
< style>
<!-- #EndEditable --> < head> <body> <center>
<img alt="not supported" height="816"
src="google-logo-png-google-sva-scholarship-20.png" width="508" /><br />
WELCOME TO GOOGLE</center>
<!-- #BeginEditable "para" …-> <p>Body:</p>
<p>MY First page</p>
<p class="auto-style1"> </p>
<!-- #EndEditable -->
<p>Made By Raunak Nath, 12A</p> < body>
<!-- #EndTemplate --> </html>
83
DWT
CODE:-
<!DOCTYPE html PUBLIC
"_//W3C//DTD XHTML 1.0 Transitional//EN'
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
xmIns="http://www.w3.org/1999/xhtml"> <head>
<meta content="en-in" http-equiv="Content-Language" /> <meta
content="text/html; charset=utf-8" http-equiv="Content-Type" />
<! - #BeginEditable "doctitle" _-> <title>WELCOME TO GOOGLE</title> <!--
#EndEditable --> < head> <body> <center> <img
alt="not
supported"
height="816"
sre="google-logo-png-google-sva-scholarship-20png" width="508" /><br />
WELCOME TO GOOGLE< center>
<!-- #BeginEditable "para" _-> <p>Body:</p> <p> </p>
<p> </p>
<!-- #EndEditable -->
<p>Made By Raunak Nath, 12A</p> < body> < html>
84
Snippets
85
Sec-C-Project/
Expeditionary learning
87
VEER GATHA
90
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>World Cup Tickets On Sale!</title>
<style>
91
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
text-align: center;
margin: 20px;
}
h1 {
color: #3498db;
}
p{
color: #555;
}
form {
max-width: 400px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin: 10px 0 5px;
color: #333;
}
92
input,
select {
width: 100%;
padding: 10px;
margin-bottom: 10px;
box-sizing: border-box;
}
button {
background-color: #3498db;
color: #fff;
border: none;
padding: 10px 20px;
margin: 10px 5px;
cursor: pointer;
border-radius: 4px;
}
button:hover {
background-color: #2980b9;
}
#message {
color: #27ae60;
margin-top: 10px;
}
</style>
</head>
<body>
93
<form id="ticketForm">
<label for="buyerName">Buyer's Name:</label>
<input type="text" id="buyerName" name="buyerName" required>
<option value="silver">Silver</option>
<option value="regular">Regular</option>
</select><br>
<p id="message"></p>
</form>
<script>
function calculateTicketPrice() {
const buyerName = document.getElementById('buyerName').value;
const seatOption = document.getElementById('seatOption').value;
const numTickets = document.getElementById('numTickets').value;
const discount = 10; // You can adjust the discount value as needed
document.getElementById('ticketPrice').value = `₹${ticketPrice}`;
95
function clearForm() {
document.getElementById('ticketForm').reset();
document.getElementById('ticketPrice').value = '';
document.getElementById('message').innerText = '';
}
function closeForm() {
window.close();
}
</script>
</body>
</html>
96
International CyberFair
https://lsacyberfair22.wixsite.com/my-site-2
97
98
THE
END