Hi there,
I’m trying to set up an online photo album and in making it as simple to administer in the future, I’m giving myself all sorts of javascript grief…
I want to select an image from a pull-down menu and then be able to load a corresponding html file as a result of clicking a neighbouring button, but I can’t work it out…
For example, if you select “album 001” which loads “pics/oo1.jpg”, how can you get the button to load (in the main window) “album001/album001.htm”?
Help greatly appreciated (code below)
Steve.
<html>
<head>
<title>Photo Album</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
function changeImage()
{
mainimage.src = list.options[list.selectedIndex].value;
}
function prevImage()
{
if(list.selectedIndex == 0)
{
list.selectedIndex = 0;
}
else
{
list.selectedIndex–;
}
changeImage();
}
function nextImage()
{
if(list.selectedIndex == list.options.length-1)
{
list.selectedIndex = list.options.length-1;
}
else
{
list.selectedIndex++;
}
changeImage();
}
// End –>
</script>
</head>
<body onLoad=”javascript:changeImage()” marginwidth=”0″ marginheight=”0″ leftmargin=”0″ topmargin=”0″
bgcolor=”#ffffff” text=”#333333″ link=”#333333″ alink=”#333333″
vlink=”#333333″>
<table border=”0″ width=”100%” height=”100%” cellpadding=”0″ cellspacing=”0″>
<tr><td align=”center” valign=”middle”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr><td width=”590″ height=”10″> </td></tr>
<tr>
<td background=”images/background.gif”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”590″ height=”440″ align=”center” valign=”middle”>
<tr>
<td width=”150″ height=”440″>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”150″ height=”440″>
<tr><td width=”150″ height=”80″> </td></tr>
<tr><td width=”150″ height=”230″ alt=”Title”> </td></tr>
<tr><td width=”150″ height=”25″>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ height=”25″ align=”center” valign=”middle”>
<tr>
<td><a href=”#” onclick=”javascript: prevImage()”><img src=”images/back-all.gif” border=”0″></a></td>
<td><img src=”images/back.gif” border=”0″></a></td>
<td><a href=”#”>
[b]<!–click here to load the album selected on this page. ie album001/album001.htm –>
<img src=”images/next.gif” border=”0″></a></td>
<td><a href=”#” onclick=”javascript: nextImage()”><img src=”images/next-all.gif” border=”0″></a></td>
</tr>
</table></td></tr>
<tr><td width=”150″ height=”25″ align=”center” valign=”middle”>
<select id=”list” onchange=”javascript: changeImage()”>
<option value=”pics/001.jpg”>Album 001</option>
<option value=”pics/002.jpg”>Album 002</option>
<option value=”pics/003.jpg”>Album 003</option>
<option value=”pics/004.jpg”>Album 004</option>
<option value=”pics/005.jpg”>Album 005</option>
<option value=”pics/006.jpg”>Album 006</option>
<option value=”pics/007.jpg”>Album 007</option>
<option value=”pics/008.jpg”>Album 008</option>
<option value=”pics/009.jpg”>Album 009</option>
</select></td></tr>
<tr><td width=”150″ height=”80″> </td></tr>
</table>
</td>
<td width=”440″ height=”440″ align=”center” valign=”middle”><img name=”mainimage”></td>
</tr>
</table>
</td>
</tr>
<tr><td width=”590″ height=”10″> </td></tr>
</table>
</td></tr>
</table>
</body>
</html>