I’m brand new at making JavaScript programs. I’m taking my first class and am already far behind because our teacher is absolutely HORRIBLE and doesn’t teach us anything. I have about 6 programs I have to make and I’m about to give up.
The only one I have any code for is a program where we have to create a drop-down box and have it display one of 3 picture choices.
I’ve gotten as far as creating the drop-down box but I don’t know what to do to get it to display the pictures.
This is the code I have for this program:
[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Language” content=”en-us” />
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Project6</title>
<style type=”text/css”>
.style1
{ text-align: left; }
.style2
{
text-align: center;
font-size: x-large;
}
</style>
<script language =”javascript”>
function showimage(){
if (!document.images)
document.image.pictures.src=
document.mygallery.options[document.mygallery.picture.selectedIndex].value
return
}
</script>
</head>
<body>
<p class=”style2″>This program will display different pictures.</p>
<div class=”style1″ style=”height: 22px; width: 833px”>
<select name=”picture” size=”1″ onchange=”showimage()”>
<option selected=”selected” value=”Picture1.jpg”>Picture 1</option>
<option value=”Picture2.jpg”>Picture 2</option>
<option value=”Picture3.jpg”>Picture 3</option>
</select> </div>
</body>
</html>
Picture1, Picture2, and Picture 3 are the names of the pics.
What I don’t know is what functions or actions or whatever it is I need to do to get this box to display these pictures?
If anyone can help with this I’d be extremely grateful