View Full Version : js if then else help
03-08-2011, 02:08 AM
I am making a web site for my friend that sells wallets and other things. I am making an online order form for him. First you chose your product (in a select box) then you chose your color (in radio buttons). The problem is, each product has different possible colors, and I need the radio buttons to change text for each product? I think you need js to do this. Can someone please show me the code for this task?
03-08-2011, 03:38 AM
Are you sure this isn't some sort of homework exercise? because if it was genuine I would normally generate the html directly on the server using a server side language or AJAX.
Can you post your code you have so far and describe where you are currently storing the text that goes with each radio button depending on which product was chosen.
03-09-2011, 12:34 AM
No, it's not a homework project haha...
Here is the code:
<input type="radio" id ="color" name ="color 1 choice" />
<label for = "color1">Grey</label>
<input type="radio" id ="color1" name ="color 1 choice" />
<label for = "color">Red</label>
<input type="radio" id ="color2" name ="color 1 choice" />
<label for = "color">Blue</label>
<input type="radio" id ="color3" name ="color 1 choice" />
<label for = "color">Black</label>
<input type="radio" id ="color4" name ="color 1 choice" />
<label for = "color">Green</label>
03-09-2011, 06:19 AM
03-09-2011, 06:40 PM
actually, I had another look at the link I sent and there seems to be a lot of set up time involved. I have a similar set up here (http://www.xelawho.com/map/drive.htm) using a slightly different technique which I remember not being so much work to fill in all the various options.
03-09-2011, 11:34 PM
Thanks a million!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.