| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | Quick Question. Hope someone can help Hey Everyone. I need to know how in the world I can make it so the 3-6, 6-12, and 12-18 options will only show that white is available. Every other size except these are available in the other colors. Code:
<td><select name="os1" class="cnt" id="size">
<option>3-6mo</option>
<option>6-12mo</option>
<option>12-18mo</option>
<option>2T</option>
<option>3T</option>
<option>4T</option>
<option>XS</option>
<option>S</option>
</select>
<select name="os0" class="cnt" id="select">
<option selected>White</option>
<option>Red</option>
<option>Gray</option>
</select>
<input name="on0" type="hidden" id="on02" value="color" />
<input name="on1" type="hidden" id="on12" value="size" />
<input name="quantity" type="text" id="quantity2" value="1" size="3" maxlength="5" /></td>
</tr>
</table></td>
__________________ Mascot Factory- Custom Plush, Promotional Plush, and Personalized Teddy Bears|The Squidget - The tiny travel trailer you build from plans| |
| |
| | #2 (permalink) |
| NPQ's PA, Slave, and On Call Coder Technical Services | Not the best, but it works. PHP Code:
__________________ |
| |
| | #3 (permalink) |
| NamePros Member | Code: <script type='text/javascript'>
function disableColors(select) {
var sId = select.selectedIndex < 3?true:false;
var colors = document.getElementById('select');
colors.options[1].disabled = sId;
colors.options[2].disabled = sId;
if (sId && colors.selectedIndex > 0) colors.selectedIndex = 0;
}
</script>
<select name="os1" class="cnt" id="size" onchange="disableColors(this);">
<option>3-6mo</option>
<option>6-12mo</option>
<option>12-18mo</option>
<option>2T</option>
<option>3T</option>
<option>4T</option>
<option>XS</option>
<option>S</option>
</select>
<select name="os0" class="cnt" id="select">
<option>White</option>
<option>Red</option>
<option>Gray</option>
</select>
When you change the size of the shirt, check which size you changed it to. If its the first, second, or third option (selectedIndex starts with the top option being 0, so when selectedIndex < 3), disable the second and third color options. After doing that, check which color was previously selected. If you had to disable options And the second or third color was selected, set it to white. Bruce |
| |
| | #4 (permalink) |
| Senior Member | Thanks for everyones help. I will try to implement this and see what happens
__________________ Mascot Factory- Custom Plush, Promotional Plush, and Personalized Teddy Bears|The Squidget - The tiny travel trailer you build from plans| |
| |
| | #5 (permalink) |
| Senior Member | Hey Eric, I have another question. Is there a way to make that so it will always show 3-6 and white as the default? So the first thing someone sees in the drop down would look this 3-6 White instead of ------ ------- Then the customer would be able to pick the other sizes and color. The reason I want to do this is these are only available in white <option>3-6mo</option> <option>6-12mo</option> <option>12-18mo</option> The other ones are multiple colors. Thanks again
__________________ Mascot Factory- Custom Plush, Promotional Plush, and Personalized Teddy Bears|The Squidget - The tiny travel trailer you build from plans| |
| |
| | #7 (permalink) |
| Senior Member | Thanks Shockie I will try that out tonight
__________________ Mascot Factory- Custom Plush, Promotional Plush, and Personalized Teddy Bears|The Squidget - The tiny travel trailer you build from plans| |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |