-
Notifications
You must be signed in to change notification settings - Fork 0
/
exerciseFive.js
32 lines (28 loc) · 1016 Bytes
/
exerciseFive.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const submitMultiply = (event) => {
event.preventDefault(); // Prevent form submission
// Get the input values
const numberOne = parseFloat(document.getElementById("numberOne").value);
console.log(numberOne)
const numberTwo = parseFloat(document.getElementById("numberTwo").value);
console.log(numberTwo)
// Check if both input values are valid numbers
if (!isNaN(numberOne) && !isNaN(numberTwo)) {
const result = numberOne * numberTwo;
// Display the result
document.getElementById("multipleResult").textContent = "Result: " + result;
console.log(result)
} else {
// Handle invalid input
document.getElementById("multipleResult").textContent = "Invalid input";
}
};
var imageFive = document.querySelector('#exImageFive');
function addImageFive(){
imageFive.src = './assets/img/exerciseFive.PNG';
var y = document.getElementById("exImageFive");
if (y.style.display === "none") {
y.style.display = "block";
} else {
y.style.display = "none";
}
}