WP LAB 3-8no
WP LAB 3-8no
Write a JavaScript to design a simple calculator to perform the following operations: sum,
product,di erence, and quotient.
<!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>
//To Get Input from The user
const num1=parseFloat(prompt("Enter the First Number:"));
const num2=parseFloat(prompt("Enter the Second Number:"));
<script>
for (let i = 0; i <= 10; i++) {
let square = i * i;
let cube = i * i * i;
document.getElementById('resultTable').innerHTML +=
`<tr>
<td>${i}</td>
<td>${square}</td>
<td>${cube}</td>
</tr>`;
}
</script>
</body>
</html>
5.Write a JavaScript code that displays text “TEXT-GROWING” with increasing font size in the interval
of 100ms in RED COLOR, when the font size reaches 50pt it displays “TEXT-SHRINKING”in BLUE color.
Then the font size decreases to 5pt.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Growing and Shrinking</title>
<style>
#text {
color: red; /* Initial color */
font-size: 10pt; /* Starting font size */
transition: font-size 0.1s; /* Smooth transition */
}
</style>
</head>
<body>
<div id="text">TEXT-GROWING</div>
<script>
let fontSize = 10; // Starting font size
const textElement = document.getElementById('text');
function shrinkText() {
fontSize = 50; // Reset to max size to start shrinking
const shrinkInterval = setInterval(() => {
if (fontSize > 5) {
fontSize--;
textElement.style.fontSize = fontSize + 'pt';
} else {
clearInterval(shrinkInterval);
}
}, 100);
}
</script>
</body>
</html>
6. Develop and demonstrate an HTML file that includes a JavaScript script that uses functions for the
following problems:
a. Parameter: A string Output: The position in the string of the left-most vowel
b. Parameter: A number Output: The number with its digits in the reverse order
7.Write a PHP program to keep track of the number of visitors visiting the web page and to display this
count of visitors, with proper headings.
8.Write a PHP program to display a digital clock which displays the current time of the server.