2016-08-18 14 views
2

検証は、Safariを除くすべてのブラウザでうまくいきます。 3つのセクション(a、b、c)があります。サファリのAとCセクションは完璧に動作します。しかし、Bセクションをクリックすると、「画像を入力しない」というアラートが表示されます。私の結果はalert('Enter total no. of images');です。javascriptサファリで作業していないフォーム提出と他のすべてのブラウザで動作しますか?

function validate() 
{ 

    if(document.commentform2.rb.value=='wed_custom') 
{ 
    if(document.commentform2.cull_onoffswitch.checked===true) 
    { 
     if(document.commentform2.cull_images.value=='') 
     { 

      alert('Enter Cull total images'); 
      document.commentform2.cull_images.focus();  
      return false; 
     } 
     if(document.commentform2.cull_max.value=='') 
     { 
      alert('Enter Maximum no. of images'); 
      document.commentform2.cull_max.focus();  
      return false; 
     } 
    } 
    else if(document.commentform2.str_onoffswitch.checked===false) 
    { 
     if(document.commentform2.total_images_lr.value=='') 
     { 
      alert('Enter total no. of images'); 
      document.commentform2.total_images_lr.focus();  
      return false; 
     } 
    } 

} 
else { 
if(document.commentform2.no_images.value=='') 
{ 
    alert('Enter Number of images'); 
    document.commentform2.no_images.focus();   
    return false; 
} 
} 

return true; 
} 

答えて

0

コード if(document.commentform2.rb.value=='wed_custom')は常にtrue

を与える参照してください

if(document.getElementById('Id').getAttribute('checked') === 'checked') 
+0

thanksssssでこのラインを交換してください....その作業は... –

+0

@creativeはいいですね:) – Jyothu

関連する問題