Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to create a page that displays one of 3 images at a time. below the

ID: 3640611 • Letter: I

Question

I am trying to create a page that displays one of 3 images at a time. below the image it should be 3 button that are label with the name of the image. when I click on a button, it should display the image according to radio button.
This is what I have so far:

<html>
<head>
<script type="text/javascript">
function changeImage(newImage)
{
if document['image_name'].src = eval(newImage + ".src");
}

button1 = new Image();
button1.src = "saw.jpeg";

button2 = new Image();
button2.src = "planer.jpeg";

button3 = new Image();
button3.src = "monkey_wrench.jpeg";
</script>

<p align="center"><img name="image_name" src="New folderimage" /><p>

</head>
<p align = "center">
<input type="button" value="Saw" />
<input type="button" value="Planner" />
<input type="button" value="Monkey wrench" />
</p>
</body>
</html>

Explanation / Answer

Here's a fixed up version of what you wanted. Just make sure that you use the right ending for each image. (For example, JPEGs can use .jpg and .jpeg) Good luck! ------------------------------- function changeImage(newImage) { document["image_name"].src = directory + eval(newImage + ".name"); } var directory = "New folder/image/"; button1 = new Image(); button1.name = "saw.jpeg"; button2 = new Image(); button2.name = "planer.jpeg"; button3 = new Image(); button3.name = "monkey_wrench.jpeg";

-------------------------------
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote