title: Check and set the visibility of table rows
body: <p>I have a table with a few rows, in which each row becomes visible if the field in the row above it is not blank. I have written a working script, but I am new to Javascript and feel like it is too involved. In other words, is there a better, more concise solution to this problem? I would need to perform the same solution in several locations, so a better solution would be very welcome. </p>
  
  <pre><code>&lt;script language="javascript"&gt;
     function MyTableRow(){
      //Row 1
   if(document.getElementById("DQ23I1010").value=="") 
    {
      //alert("test");
      document.getElementById("myRow1").style.display='none';
  }
  else
  {
      document.getElementById("myRow1").style.display='block';   
  }
  
   //Row 2
  if(document.getElementById("DQ24I1011").value=="") 
    {
      document.getElementById("myRow2").style.display='none';
  }
  else
  {
      document.getElementById("myRow2").style.display='block';   
  }
  //Row 3
  if(document.getElementById("DQ25I1012").value=="") 
  {
      document.getElementById("myRow3").style.display='none';
  }
  else
  {
      document.getElementById("myRow3").style.display='block';   
  }
  //Row 4
  if(document.getElementById("DQ26I1013").value=="") 
  {
      document.getElementById("myRow4").style.display='none';
   }
  else
  {
      document.getElementById("myRow4").style.display='block';   
  }
  //Row 5
     if(document.getElementById("DQ27I1014").value=="") 
  {
      document.getElementById("myRow5").style.display='none';
  }
  else
  {
      document.getElementById("myRow5").style.display='block';   
  }
  //Row 6
  if(document.getElementById("DQ28I1015").value=="") 
  {
      document.getElementById("myRow6").style.display='none';
  }
  else
  {
      document.getElementById("myRow6").style.display='block';   
  }
  //Row 7
  if(document.getElementById("DQ29I1016").value=="") 
  {
      document.getElementById("myRow7").style.display='none';
  }
  else
  {
      document.getElementById("myRow7").style.display='block';   
  }
   //Row 8
   if(document.getElementById("DQ30I1017").value=="") 
  {
      document.getElementById("myRow8").style.display='none';
  }
  else
  {
      document.getElementById("myRow8").style.display='block';   
  }
    //Row 9
  if(document.getElementById("DQ31I1018").value=="") 
  {
      document.getElementById("myRow9").style.display='none';
  }
  else
  {
      document.getElementById("myRow9").style.display='block';   
  }
   //Row 10
   if(document.getElementById("DQ32I1019").value=="") 
  {
      document.getElementById("myRow10").style.display='none';
  }
  else
  {
      document.getElementById("myRow10").style.display='block';   
  }
  } 
  
  &lt;/script&gt;
  </code></pre>