0% found this document useful (0 votes)
12 views13 pages

21761A0590 Javascript

javascript material

Uploaded by

GANESH JAGGINENI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views13 pages

21761A0590 Javascript

javascript material

Uploaded by

GANESH JAGGINENI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

JAVASCRIPT MODUL

Infosys Activities

8/1/2023

GANESH JAGGINENI _ 21761A0590


LBRCE
Identifiers:
1)To calculate the radius of the circle.

<html>
<head>
<title>AREA OF CIRCLE</title>
<head>

</head>

<body>
<input type="text" id="val"/>
<input type="submit" value="submit" onClick="area()">
<script>
function area()
{

var radius=document.getElementById("val").value;
document.write(radius);
const pi=Math.PI;
let area;
area=pi*radius*radius;
document.write(area);
}
</script>
</body>
</head>

OUTPUT
DATATYPES
<!DOCTYPE html>
<html>
<head>
<title>Movie Details</title>
<style>
div#maincontent {
height: 300px;
width: 500px;
border: 1px solid #CEE2FA;
text-align: left;
color: #08438E;
font-family: calibri;
font-size: 20;
padding: 5px;
}
div#heading {
text-decoration: bold;
text-align: center;
margin-top: 80px;
width: 500px;
border: 1px solid #CEE2FA;
text-align: center;
color: #08438E;
background-color: #CEE2FA;
font-family: calibri;
font-size: 20;
padding: 5px;
}
</style>
</head>
<body>
<center>
<div id="heading">Movie Details</div>
<div id="maincontent">
<div>
MOvie Name :<input type="text" id="moviename">
</div>
<div>
Movie Language :<input type="text" id="movielang">
</div>
<div>
Movie rating :<input type="text" id="movierating">
</div>
<div>
<input type="submit" onClick="displaymovie()">
</div>
<center>
<span id="res">

</span>
</center>
</div>
</center>
<script>
function displaymovie()
{
let movie_name;
let movie_language;
let movie_rating;

movie_name=document.getElementById('moviename').value;
movie_language=document.getElementById('movielang').value;
movie_rating=document.getElementById('movierating').value;
document.getElementById('res').innerText=`movie name :$
{movie_name}\nmovie language:${movie_language}\nmovie rating :$
{movie_rating}`;
// document.getElementById('res').innerHTML=movie_language;
// document.getElementById('res').textContent=movie_rating;
// document.write(movie_name);
// document.writeln(movie_language);
// document.writeln(movie_rating);
}
</script>
</body>

</html>
OUTPUT
LOOPS
<!DOCTYPE html>
<html>
<head>
<title>Booking Details</title>
<style>
div#maincontent {
height: 530px;
width: 600px;
border: 1px solid #CEE2FA;
text-align: left;
color: #08438E;
font-family: calibri;
font-size: 20;
padding: 5px;
}
div#heading {
text-decoration: bold;
text-align: center;
margin-top: 80px;
width: 600px;
border: 1px solid #CEE2FA;
text-align: center;
color: #08438E;
background-color: #CEE2FA;
font-family: calibri;
font-size: 20;
padding: 5px;
}
h4 {
padding: 0;
margin: 0;
}
#datashow{
color:red;
}
</style>
</head>
<body>
<center>

<div id="heading">
<b>Theatre Drama</b>
</div>
<div id="maincontent">
<div>
<h3>Enter no.of seats wanted to book :</h3>
<input type="text" id="seats_count">
<input type="submit" onclick="ticket_price()">
</div>
<h3>Your Ticket Details:</h3>
<div id="datashow">

</div>
<br>
<script>
function ticket_price()
{

let cost=9;
var c1,c2=5,tc,s=0;
let total_cost;
var
seats=document.getElementById("seats_count").value;

if(seats<=2)
{

total_cost=cost*seats;

document.getElementById("datashow").innerHTML="<h2
style='color:red'>ticket price = "+total_cost+"</h2>";

}
else if(seats>=5)
{

document.getElementById("datashow").innerHTML="<h2
style='color:red'>booking is not allowed</h2>";
}
else if(seats>2 && seats<5)
{
for(let i=1;i<=4;i++)
{
c1=cost-((cost*c2)/100);
s=s+c1;
document.getElementById("datashow").innerHTML
+="<h2>Ticket for Customer "+i+" gets"+c2+"% discount!, Cost is:
$"+c1+"</h2>"+"<br>";
c2=c2+2;
}
tc=seats*9;
document.getElementById("datashow").innerHTML
+="<h2>For "+seats+" , you need to pay:$"+s+" instead of $"+tc+"</h2>";
}

}
</script>
</div>
</center>
</body>
</html>

OUTPUT
OPERATORS
<!DOCTYPE html>
<html>
<head>
<title>Ticket Details</title>
<style>
div#maincontent {
height: 280px;
width: 500px;
border: 1px solid #CEE2FA;
text-align: left;
color: #08438E;
font-family: calibri;
font-size: 20;
padding: 5px;
}
div#heading {
text-decoration: bold;
text-align: center;
margin-top: 80px;
width: 500px;
border: 1px solid #CEE2FA;
text-align: center;
color: #08438E;
background-color: #CEE2FA;
font-family: calibri;
font-size: 20;
padding: 5px;
}
h4 {
padding: 0;
margin: 0;
}
input[type=text]
{
/* color:green; */
font-size:20px;
border:2px dashed;
}
input[type=text]:focus{
color:chartreuse;
border:3px groove;
}
</style>
</head>
<body>
<center>
<div id="heading">
<b>Theatre Drama</b>
</div>
<div id="maincontent">
<h3>Enter no.of seats wanted to book :</h3>
<input type="text" id="seats_count">
<input type="submit" onclick="clac_price()">
<h4>Your Ticket Details:</h4>
<center>
<div id="display">

</div>
</center>
<br>
<script>
//Write the code to calculate the total price and
discounted price for the tickets
function clac_price()
{
let cost,discount,final_cost;
var seats=document.getElementById("seats_count").value;
if(seats>0)
{
cost=seats*9;
let initialdisc=10;
discount=0.1*cost;
final_cost=cost-discount;
data();
function data()
{
// event.preventDefault();
document.getElementById("display").innerHTML
='';

document.getElementById("display").innerHTML +=
"<h3>Total No.of Seats Booked:
"+seats+"</h3>"
+"<h3>Total cost of "+seats+" Tickets :
$"+cost+" </h3>"
+"<h3>Festive Season Discount Is :
"+initialdisc+"%</h3>"
+"<h3>Total Cost After Discount Is :
$"+final_cost+"%</h3>";
}

}
else if(seats==0)
{
document.getElementById("display").innerHTML="<h3>jaffa ,please enter a
number >0</h3>";
}
}
</script>
</div>
</center>
</body>
</html>

OUTPUT

You might also like