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

Dropdown changing values ( javascript & asp )

Fary4u
100+
P: 273
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
Expand|Select|Wrap|Line Numbers
  1.     <select id="cboColours" name="drpcolor" onChange="show()">
  2.     <option selected value="1">Make Selection</option>
  3.     <%=PopulateCombo(rsColours,"comboName","comboName")%>
  4.     </select>
  5.     <script>
  6.     function show()
  7.      {
  8. document.form1.drpcolor.options[document.form1.drpcolor.selectedIndex].value
  9.      }  
  10.     </script>
  11.     <%
  12.       if intcat = "3" then
  13.           if comboName <> 4 then
  14.               intprice = intprice - 5
  15.           elseif comboName <> 8 then
  16.               intprice = intprice - 7      else
  17.           endif
  18.       else
  19.               intprice = intprice
  20.       endif
  21.     %>
  22.  
any help thx in advance
Fary
Jan 23 '09 #1
Share this Question
Share on Google+
6 Replies


Fary4u
100+
P: 273
Hi Jhardman i need it to sort urgent any solution plz let me know
coz u always help me on hard time
Thx
Fary
Jan 23 '09 #2

kenobewan
Expert 2.5K+
P: 4,871
What version is asp is this?
Jan 25 '09 #3

Fary4u
100+
P: 273
ASP Classic but i think i'm almost done the code
Jan 25 '09 #4

kenobewan
Expert 2.5K+
P: 4,871
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 :).
Jan 26 '09 #5

acoder
Expert Mod 15k+
P: 16,027
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.
Jan 26 '09 #6

jhardman
Expert 2.5K+
P: 3,405
Hey Fary,

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

Jared
Jan 26 '09 #7

Post your reply

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