Document1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body onload="fun()">
<button onclick="fun()">JSR</button>
<button onclick="run()">RANCHI</button>
<button onclick="bun()">BOKARO</button>
<div id="op"></div>
<script>
function fun()
{
document.getElementById("op").innerHTML="<b>Jamshedpur</b> is a large city set between the Subarnarekha and Kharkai rivers in the east Indian state of Jharkhand. It’s known for huge, tree-lined Jubilee Park, where the Tata Steel Zoological Park has resident species including tigers and leopards. To the east, the hilltop Bhuvaneshwari Temple has an elaborate 5-story entrance tower. North of the city, elephants roam through the forests at Dalma Wildlife Sanctuary.";
}
function run()
{
document.getElementById("op").innerHTML="<b>Ranchi</b> is the capital of the Indian state of Jharkhand. Ranchi was the centre of the Jharkhand movement, which called for a separate state for the tribal regions of South Bihar, northern Odisha, western West Bengal and the eastern area of what is present-day Chhattisgarh. ";
}
function bun()
{
document.getElementById("op").innerHTML="<b>Bokaro</b>, officially known as Bokaro Steel City, is a large and planned city in Jharkhand, India. It is the fourth most populous city in the state and one of the first planned cities of India. Bokaro is the administrative headquarters of Bokaro district.";
}
</script>
</body>
</html>
Using of Airthmetic operator: + , - , * , / , % , **.
To find Sum of two numbers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var a, b, sum;
a=10;
b=20;
sum=a+b;
//alert(sum);
alert("Result= "+ sum);
</script>
</body>
</html>
To find Area of a circle with alternate calling method.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var r, result;
r=10;
result= 3.14*r*r;
alert("Result= " + result);
</script>
</body>
</html>
Using of Assignment Operator. = , += ,-= ,*= , /=
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
a=10;
a+=5;
alert(a);
</script>
</body>
</html>
Using of Comparision operator: == , === , <= , >= , != (not equal to).
Eligible for vote / Not Eligible for vote
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let age;
age=30;
if(age>=18)
{
alert("Eligible for vote");
}
else{
alert("Not Eligible for vote");
}
</script>
</body>
</html>
Even No./Not Even No.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var n;
n=44;
if(n % 2 == 0)
{
alert("Even No.");
}
else{
alert("Not Even No.");
}
</script>
</body>
</html>
Positive no. /Negative no./ zero
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var n;
n=44;
if(n > 0)
{
alert("Positive No.");
}
else if(n < 0)
{
alert("Negative No.");
}
else{
alert("Value is Zero")
}
</script>
</body>
</html>
Comments
Post a Comment