Dropdown Image Selection from db

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    Dropdown Image Selection from db

    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

    Code:
        <select id="cboColours" name="drpcolor" onChange="showimage()">
        <option selected value="1">Make Selection</option>
        <%=PopulateCombo(rsColours,"comboName","comboName")%>
        </select>
        <script>
        function showimage()
         {
          if (!document.images)
           return
           document.images.pictures.src=
           document.form1.drpcolor.options[document.form1.drpcolor.selectedIndex].value
         }  
        </script>
        <img src="color/<%= comboName %>.jpg" name="pictures" >
    RESULT LIKE CAME UP LIKE THIS
    <img src="color/<%= comboName %>" name="pictures" >
    how can i display including .jpg string with changing value
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Can you post the generated HTML code? i.e. what's the result of PopulateCombo() ?

    Comment

    • Fary4u
      Contributor
      • Jul 2007
      • 273

      #3
      Originally posted by acoder
      Can you post the generated HTML code? i.e. what's the result of PopulateCombo() ?
      <img src="" name="pictures" >

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        No, I meant line 3. Give me some examples of options in your select element.

        Comment

        Working...