Dropdown changing values ( javascript & asp )

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

    Dropdown changing values ( javascript & asp )

    Hi i'm in deadend i don't know how to do the job i'm bit confused ?
    i'm just thinking how to write the code ?

    i've got dropdown list of colors & whn i select the colors it's stored into database color Varibale is ComboName

    now the only problm is product price is fix ie ( 20$ ) & it's only 3 category ie ( intcat ).

    but the 1st 3 colors ie ( 1,2,3 ) is 5$ less then product price
    and next 4 colors ie ( 4,5,6,7 ( is 7$ less then product price

    my product price variable intprice & here is dropdown coding
    Code:
        <select id="cboColours" name="drpcolor" onChange="show()">
        <option selected value="1">Make Selection</option>
        <%=PopulateCombo(rsColours,"comboName","comboName")%>
        </select>
        <script>
        function show()
         {
    document.form1.drpcolor.options[document.form1.drpcolor.selectedIndex].value
         }  
        </script>
        <%
          if intcat = "3" then
              if comboName <> 4 then
                  intprice = intprice - 5
              elseif comboName <> 8 then
                  intprice = intprice - 7      else
              endif
          else
                  intprice = intprice
          endif
        %>
    any help thx in advance
    Fary
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    #2
    Hi Jhardman i need it to sort urgent any solution plz let me know
    coz u always help me on hard time
    Thx
    Fary

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      What version is asp is this?

      Comment

      • Fary4u
        Contributor
        • Jul 2007
        • 273

        #4
        ASP Classic but i think i'm almost done the code

        Comment

        • kenobewan
          Recognized Expert Specialist
          • Dec 2006
          • 4871

          #5
          Thought so. I assume you are aware that there is an ASP classic forum, asp is not asp.net. Well done on figuring out the code :).

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Do you want this to be coded at the client or at the server-side?

            You can't mix client-side and server-side code. Once the page has loaded, the server-side no longer runs.

            Comment

            • jhardman
              Recognized Expert Specialist
              • Jan 2007
              • 3405

              #7
              Hey Fary,

              Not sure I understand the problem. The part of the code that subtracts the price is definitely wrong, code should be:
              Code:
                  <%
                     if intcat = "3" then
                         if comboName < 4 then
                             intprice = intprice - 5
                         elseif comboName < 8 then
                             intprice = intprice - 7
                         endif
                     endif
                   %>
              But was that the only problem? I'm not sure. Please explain again if that doesn't solve everything.

              Jared

              Comment

              Working...