IT Essentials
IT Essentials
AIM:
To develop incorporate dynamism in websites using PHP scripts.
PROCEDURE:
1) Create a new HTML file and include head tag and title tag
2) Include image tag and add onmouseover property of event listener then define
a javascript function and call the function in onmouseover event
3) Define a function for changing font colour, font size and font style in
javascript call the function in onmouseover event listener.
4) Define a function to find the Armstrong number and declare the logics and
call in button onclick.
5) Get the input form the user using html form and declare the calculator function
and pass the input as parameters do the calculation and display to the user
6) Get input the user through html form and declare a function OddOrEven then
write a logic in php if(inputnumber/2)==0 then the given is even else odd and
display the result to user
PROGRAM:
1)
<!DOCTYPE html>
<html>
<head>
<title>Image Hover Change</title>
<style>
#hover-image {
width: 300px;
height: 200px;
transition: transform 0.3s ease-in-out;
}
</style>
</head>
<body>
<img id="hover-image" src="original.jpg"
onmouseover="changeImage()" onmouseout="revertImage()">
<script>
function revertImage() {
document.getElementById('hover-image').src = 'original.jpg';
}
</script>
</body>
</html>
2)
<!DOCTYPE html>
<html>
<head>
<title>Text Style Change on Hover</title>
<style>
#hover-text {
font-size: 18px;
color: black;
font-family: Arial, sans-serif;
transition: all 0.3s ease-in-out;
}
</style>
</head>
<body>
<p id="hover-text" onmouseover="changeTextStyle()"
onmouseout="revertTextStyle()">Hover over this text!</p>
<script>
function revertTextStyle() {
document.getElementById('hover-text').style.fontSize = '18px';
document.getElementById('hover-text').style.color = 'black';
document.getElementById('hover-text').style.fontFamily = 'Arial, sans-serif';
}
</script>
</body>
</html>
3)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</script>
</body>
</html>
}
h2
{
color:blue;
}
button
{
color: blue;
}
#fnumber
{
margin-left:29px ;
}
#op
{
margin-left: 139px;
}
#op_id
{
position: relative;
left: 80px;
}
#button
{
height: 30px;
border-radius: 7px;
}
</style>
</head>
<body>
<center>
<form >
<h2>Calculator Using JavaScript</h2>
<label for="fnumber">Enter the first Number:</label> <input type="text" name=""
id="fnumber" placeholder="0" ><br>
<label for="snumber">Enter the Second Number:</label> <input type="text"
name="" id="snumber" placeholder="0"><br>
<label for="op" id="op_id">Enter the Operation:</label> <input type="text"
name="Operation" id="op" placeholder="+/-">
<button onclick="calcul()" id="button">Calculate</button>
function calculateFactorial($n) {
if ($n === 0 || $n === 1) {
return 1;
} else {
return $n * calculateFactorial($n - 1);
}
$factorial = calculateFactorial($number);
6)
<!DOCTYPE html>
<html>
<head>
<title>Odd/Even Checker Result</title>
</head>
<body>
<form method="post" action="index.php">
Enter a number: <input type="number" name="number">
<input type="submit" value="Check">
</form>
<?php
if(isset($_POST['number'])) {
$number = $_POST['number'];
if($number % 2 == 0) {
echo "<p>$number is an even number.</p>";
} else {
echo "<p>$number is an odd number.</p>";
}
} else {
echo "<p>No number entered.</p>";
}
?>
</body>
</html>
function sumOfDigits($num) {
$sum = 0;
while ($num != 0) {
$digit = $num % 10;
$sum += $digit;
$num = (int)($num / 10);
}
return $sum;
}
RESULT:
Thus Incorporate audio and video elements in web with suitable html tags is executed
and verified successfully.