NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Quick Question. Hope someone can help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-06-2008, 05:10 PM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



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>
slipondajimmy is offline  
Old 07-06-2008, 05:33 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Not the best, but it works.
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html>

<
head>
    <
meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <
title>Untitled 1</title>
    <
script type="text/javascript" language="Javascript">
    function 
onlyWhite(select)
    {
        var 
select document.getElementById('size');
????: NamePros.com http://www.namepros.com/programming/489895-quick-question-hope-someone-can-help.html
        var 
value select.options[select.selectedIndex].value;
        var 
cselect document.getElementById('select');

        if (
value == '3-6mo' || value == '6-12mo' || value == '12-18mo')
        {
            
cselect.options.length 0;
            
cselect.options[0] = new Option("----------""-1"falsefalse);
            
cselect.options[1] = new Option("White""white"falsefalse);
        }
        else
        {
            
cselect.options.length 0;
            
cselect.options[0] = new Option("----------""-1"falsefalse);
            
cselect.options[1] = new Option("White""white"falsefalse);
            
cselect.options[2] = new Option("Red""red"falsefalse);
????: NamePros.com http://www.namepros.com/showthread.php?t=489895
            
cselect.options[3] = new Option("White""Gray"falsefalse);
        }
        return;
    }
    
</script>
</head>

<body>

<select name="os1" class="cnt" id="size" onchange="onlyWhite()">
    <option value="-1">----------</option>
    <option value="3-6mo">3-6mo</option>
    <option value="6-12mo">6-12mo</option>
    <option value="12-18mo">12-18mo</option>
    <option value="2T">2T</option>
    <option value="3T">3T</option>
    <option value="4T">4T</option>
    <option value="XS">XS</option>
    <option value="S">S</option>
</select>
<select name="os0" class="cnt" id="select">
    <option value="-1">----------</option>
    <option value="white">White</option>
    <option value="red">Red</option>
    <option value="gray">Gray</option>
</select>

</body>
</html> 
Eric is offline  
Old 07-06-2008, 05:35 PM   #3 (permalink)
NamePros Member
Join Date: Sep 2006
Posts: 99
Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough
 



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>
This basically says:
????: NamePros.com http://www.namepros.com/showthread.php?t=489895
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
Bruce_KD is offline  
Old 07-06-2008, 06:37 PM THREAD STARTER               #4 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



Thanks for everyones help. I will try to implement this and see what happens
slipondajimmy is offline  
Old 07-07-2008, 04:47 AM THREAD STARTER               #5 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



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
slipondajimmy is offline  
Old 07-07-2008, 04:49 AM   #6 (permalink)
Senior Member
 
shockie's Avatar
Join Date: Dec 2006
Posts: 4,702
shockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond repute
 



Code:
<option selected>3-6mo</option>
__________________
- shockie
shockie is offline  
Old 07-07-2008, 10:32 AM THREAD STARTER               #7 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



Thanks Shockie I will try that out tonight
slipondajimmy is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:51 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger