View Single Post
  #6 (permalink)  
Old Apr 24th, 2008, 00:28
CloudedVision's Avatar
CloudedVision CloudedVision is offline
Nerdy Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 942
Blog Entries: 8
Thanks: 2
Thanked 22 Times in 22 Posts
Send a message via AIM to CloudedVision Send a message via MSN to CloudedVision Send a message via Skype™ to CloudedVision
Re: Validation code problem

Give this a shot:

Code: Select all
var checked = false; 
   var Sizes = document.BuyProduct.Sizes;

   if(typeof(Sizes[0].checked)=="undefined") {
      Sizes[0] = Sizes;
   }

   if (Sizes.length){
      for (var i=0; i<Sizes.length; i++)  
      {  
         if (Sizes[i].checked) {  
         checked = true;   
         }  
      }
   }
   else if(Sizes.checked)
   {
      checked=true;
   }
 
   if(!checked) 
   {  
      Errors++
      document.getElementById('mySpan1a').style.display='block';
      document.getElementById('mySpan1a').innerHTML='Please Select a Size!';
      document.getElementById('mySpan1b').style.display='inline';
      document.getElementById('mySpan1b').innerHTML='! ';
   }
   else
   {
      document.getElementById('mySpan1a').style.display='none';
      document.getElementById('mySpan1a').innerHTML='';
      document.getElementById('mySpan1b').style.display='none';
      document.getElementById('mySpan1b').innerHTML='';
   }
__________________
echo "Take it easy, ".$CloudedVision;
.links { site: other-road-design; blog: only-nerds-allowed; project: resource-fish; organization: ARMIES6; }
<quote>&quot;I think it's wrong that only one company makes the game Monopoly&quot; - <name>Steven Wright</name></quote>
Reply With Quote