By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,527 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,527 IT Pros & Developers. It's quick & easy.

Dropdown Image Selection from db

Fary4u
100+
P: 273
Hi

i'm trying to change image via selecting from dropdown list, the only problem is it's taking value from database but with out ".jpg" string here is my coding

Expand|Select|Wrap|Line Numbers
  1.     <select id="cboColours" name="drpcolor" onChange="showimage()">
  2.     <option selected value="1">Make Selection</option>
  3.     <%=PopulateCombo(rsColours,"comboName","comboName")%>
  4.     </select>
  5.     <script>
  6.     function showimage()
  7.      {
  8.       if (!document.images)
  9.        return
  10.        document.images.pictures.src=
  11.        document.form1.drpcolor.options[document.form1.drpcolor.selectedIndex].value
  12.      }  
  13.     </script>
  14.     <img src="color/<%= comboName %>.jpg" name="pictures" >
  15.  
RESULT LIKE CAME UP LIKE THIS
<img src="color/<%= comboName %>" name="pictures" >
how can i display including .jpg string with changing value
Jan 20 '09 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
Can you post the generated HTML code? i.e. what's the result of PopulateCombo()?
Jan 20 '09 #2

Fary4u
100+
P: 273
@acoder
<img src="" name="pictures" >
Jan 22 '09 #3

acoder
Expert Mod 15k+
P: 16,027
No, I meant line 3. Give me some examples of options in your select element.
Jan 22 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.