I have simple script designed to check if
  1. If a div1 is visible (display : none or block)
  2. if a textfield has any content


The page is designed to show a div section containing 4 text fields that are repeated on the page depending on the above conditions, so if a qty is entered in the first section if would check if the second div is set to display : none and if it is change this to block so it is viewable, it then also checks to see see if they first quantity field is not blank so it does not toggle the form back to none on entering a second figure.

Code:
<script type="text/javascript">
function toggle_visibility(id, tf) {
var e = document.getElementById(id);
var f = document.getElementById(tf) ;
if(e.style.display == 'none' && f.value != '')
e.style.display = 'block';
else
e.style.display = 'none';
}
</script>
HTML

Code:
<input name="QUANTITY1" type="text" class="txtfield"  id="QUANTITY1" title="" onkeyup="toggle_visibility('Part2','QUANTITY1');" value="" size="4" maxlength="10"/>

<div id="Part2" style="display: none;">
Part2 <input class="txtfield" name="PART_NO2" type="text" id="PART_NO2" title="" value="" size="16" />
Size  <input class="txtfield" name="SIZE2" type="text" id="SIZE2" title="" value="" size="8" />
Qty <input class="txtfield" name="QUANTITY2" type="text" id="QUANTITY2" title="" value="" size="4" maxlength="10" />
</div>
But for some reason the second part of the JavaScript if condition is being ignored and it just toggle the display with each key entry, Have I missed something simple?

Thanks for looking. (it's been a long day and it's not getting any shorter!)