<form> <script> function hidetable(form, ord, rwcnt){ //alert( document.getElementById(ord).style.display ); var hide = false; var btnstr = "mybutton"+ord; if( document.getElementById(ord).style.display == 'block' || document.getElementById(ord).style.display == ""){ document.getElementById(ord).style.display = 'none'; document.getElementById(ord).style.visibility = 'hidden'; document.getElementById(btnstr).value = "+"; //form.btnstr.value = "+"; hide = true; }else{ document.getElementById(ord).style.display = 'block'; document.getElementById(ord).style.visibility="visible"; document.getElementById(btnstr).value = "-"; //form.btnstr.value = "-"; hide = false; } for( i=0; i< rwcnt; i++ ){ var drow = ord+""+i; if( document.getElementById(drow)){ if( hide ){ document.getElementById(drow).style.display = 'none'; document.getElementById(drow).style.visibility = 'hidden'; }else{ document.getElementById(drow).style.display = 'block'; document.getElementById(drow).style.visibility="visible"; } } } } </script> <INPUT Type="BUTTON" name=<VALUE-OF>"mybutton"+row["property_id"]</VALUE-OF> Value="-" onClick='hidetable( this.form, <VALUE-OF>row["property_id"]</VALUE-OF>, <VALUE-OF>row["Aggregation"]</VALUE-OF> )'></INPUT> <VALUE-OF>row["property_id"]</VALUE-OF> <script> hidetable( this.form, <VALUE-OF>row["property_id"]</VALUE-OF>, <VALUE-OF>row["Aggregation"]</VALUE-OF> ); </script> </form>