Frogger
07-07-2006, 12:49 AM
Hi,
I have being trying to work out this problem for hours hense why I am asking for some help now please. I am trying to use data from a database where I can change an image when I make a selection from a combo box. The combo box can read the values from the database fine. I just cant work out how to make the image change when I make the corresponding selection.
See below for info in access database
filename plantname
cordyline.jpg CORDYLINE AUSTRALIS
CYCAD.jpg CYCAS REVOLUTA
BANGALOW_PALM.jpg ARCHONTOPHOENIX CUNNINGHAMIANA
Below is the script. I am trying to make the blank.gif image change to the filename when I select the plantname from the corresponding selection.
IE when I select CORDYLINE AUSTRALIS I want the blank.gif to chnage to the cordyline.jpg image. I guess the onchnage function has to be used just not sure where or even if I have set this up correctly. Can anyone please help me on this.
Frogger
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>plants</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="770" height="576" border="1" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td width="50%"><img src="images/blank.gif" name="blank" width="150" height="150" id="blank">
</td>
<td width="50%"><img src="images/blank.gif" name="blank2" width="150" height="150" border="0" id="blank2"></td>
</tr>
<tr align="center" valign="middle">
<td width="50%">
<form name="choose">
<select name="list" >
<%
Response.Buffer = true
dim cnn,rst
set cnn = Server.CreateObject("ADODB.Connection")
set rst = Server.CreateObject("ADODB.RecordSet")
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=c:/www/plants.mdb;"
sqltext = "SELECT * FROM plants"
Set RS = cnn.Execute(sqltext)
WHILE NOT RS.EOF
%>
<option value="<%=RS("filename")%>"><%=RS("plantname")%></option>
<%
RS.MoveNext
WEND
RS.Close
cnn.Close
%>
</select>
</form>
</td>
<td width="50%"> </td>
</tr>
</table>
</body>
</html>
I have being trying to work out this problem for hours hense why I am asking for some help now please. I am trying to use data from a database where I can change an image when I make a selection from a combo box. The combo box can read the values from the database fine. I just cant work out how to make the image change when I make the corresponding selection.
See below for info in access database
filename plantname
cordyline.jpg CORDYLINE AUSTRALIS
CYCAD.jpg CYCAS REVOLUTA
BANGALOW_PALM.jpg ARCHONTOPHOENIX CUNNINGHAMIANA
Below is the script. I am trying to make the blank.gif image change to the filename when I select the plantname from the corresponding selection.
IE when I select CORDYLINE AUSTRALIS I want the blank.gif to chnage to the cordyline.jpg image. I guess the onchnage function has to be used just not sure where or even if I have set this up correctly. Can anyone please help me on this.
Frogger
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>plants</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="770" height="576" border="1" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td width="50%"><img src="images/blank.gif" name="blank" width="150" height="150" id="blank">
</td>
<td width="50%"><img src="images/blank.gif" name="blank2" width="150" height="150" border="0" id="blank2"></td>
</tr>
<tr align="center" valign="middle">
<td width="50%">
<form name="choose">
<select name="list" >
<%
Response.Buffer = true
dim cnn,rst
set cnn = Server.CreateObject("ADODB.Connection")
set rst = Server.CreateObject("ADODB.RecordSet")
cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=c:/www/plants.mdb;"
sqltext = "SELECT * FROM plants"
Set RS = cnn.Execute(sqltext)
WHILE NOT RS.EOF
%>
<option value="<%=RS("filename")%>"><%=RS("plantname")%></option>
<%
RS.MoveNext
WEND
RS.Close
cnn.Close
%>
</select>
</form>
</td>
<td width="50%"> </td>
</tr>
</table>
</body>
</html>