HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Task 2</title>
</head>
<body>
<img src="black.circle.png" onclick="myFunction()" />
<img src="red.triangle.png" onclick="myFunction()" />
<img src="blue.square.png" onclick="myFunction()" />
<script>
var myShapes = [
"black.circle.png",
"red.triangle.png",
"blue.square.png",
];
function myFunction() {
if (myShapes[0])
alert("This is a black circle image");
}
</script>
</body>
</html>
Last edited by a moderator: