Rimuovere piu' righe selezionate tramite checkbox

Rimuovere piu' righe selezionate tramite checkbox

Salve a tutti ho bisogno di un aiuto enorme !

ho una ribrica strutturata in tabella dinamica e all'interno ho il tasto per cancellare ogni singola riga, ma vorrei anche rendere possibile l'eliminazione di piu' righe in base ai checkbox selezionati 

di seguito vi scrivo il codice della pagina e del js :


PAGINA HTML :


<html> 
<head> 
<meta charset="utf-8">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="jquery.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript" src="animazioni3.js"></script>
<LINK REL=stylesheet TYPE="text/css" HREF="prova.css" TITLE="style">
<LINK REL=stylesheet TYPE="text/css" HREF="jquery-ui-1.10.4.custom.css" TITLE="style">

</head>
<body>

<center>
<div id="dialog-form" class="div" title="Aggiungi Contatto">
  <p class="validateTips"></p>
 
  <form>
  <FIELDSET>
<LEGEND><STRONG><FONT color=red>Inserisci i Dati</FONT></STRONG></LEGEND>
    <label id="open-event" title="inserisci il tuo Nome" for="name">Nome</label>
    <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all">
<label id="open-event" title="inserisci il tuo Cognome" for="Cognome">Cognome</label>
    <input type="text" name="cognome" id="cognome" value="" class="text ui-widget-content ui-corner-all">
    <label id="open-event" title="inserisci il tuo numero di Telefono" for="tel">Telefono</label>
    <input type="text" name="tel" id="tel" value="" class="text ui-widget-content ui-corner-all">
<label id="open-event" title="inserisci la tua data di nascita" for="data">Data di nascita</label>
<input type="text" id="datepicker" class="text ui-widget-content ui-corner-all" size="30">
  </fieldset>
  </form>
</div>
 
 <center>
 <p></P>
<div id="users-contain" class="ui-widget" >
<FIELDSET style="border-width: 2; padding: 10; width: 500">
<LEGEND><STRONG><FONT color=red>Rubrica</FONT></STRONG></LEGEND>
<div align="left" >
<br>La mia Rubrica <br>
<TR>
<TD colspan=2><HR></TD>
</TR>
</div>
<p>Ricerca Contatto:</p>
<input type='text' class="InpTxt1" size='10' name='campo' />
<input type='button' value='Cerca' id="Trova" name="Cerca" />
<button id="create-user">Inserisci Contatto</button>
  <table id="users" class="ui-widget ui-widget-content">
<tr>
<td class="header" id="sel">Seleziona</td>
<td class="header">Nome</td>
<td class="header">Cognome</td>
<td class="header">Telefono</td>
<td class="header">Data di Nascita</td>
<td class="header">Cancella</td>
</tr>
    </table>
</div>
<button id="Elimina">Elimina Selezionati</button> //TASTO DI CONFERMA ELIMINAZIONE DEI checkbox SELEZIONATI
<div class="div" style="display:none" id="dialog-confirm" title="Empty the recycle bin?">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
<div style="display:none" class="freeow freeow-top-right" id="risultato" title="Risultato"></div>
</fieldset>
 </center>
</body>
</html>



JS :

$(document).ready(function(){ 
$(function() {
    var name = $( "#name" ),
      tel = $( "#tel" ),
      cognome = $( "#cognome" ),
 data = $ ("#datepicker"),
      allFields = $( [] ).add( name ).add( tel ).add( cognome ).add(data),
      tips = $( ".validateTips" );
 
    function updateTips( t ) {
      tips
        .text( t )
        .addClass( "ui-state-highlight" );
      setTimeout(function() {
        tips.removeClass( "ui-state-highlight", 1500 );
      }, 500 );
    }
 
    function checkLength( o, n, min, max ) {
      if ( o.val().length > max || o.val().length < min ) {
        o.addClass( "ui-state-error" );
        updateTips( "Verifica il campo evidenziato" );
        return false;
      } else {
        return true;
      }
    }
 
    function checkRegexp( o, regexp, n ) {
      if ( !( regexp.test( o.val() ) ) ) {
        o.addClass( "ui-state-error" );
        updateTips( n );
        return false;
      } else {
        return true;
      }
    }
 
    $( "#dialog-form" ).dialog({
      autoOpen: false,
      height: 300,
      width: 350,
      modal: true,
      buttons: {
        "Aggiungi Contatto": function() {
          var bValid = true;
          allFields.removeClass( "ui-state-error" );
 
         bValid = bValid && checkLength( name, "Nome", 1, 16 );
         bValid = bValid && checkLength( tel, "Telefono", 9, 10 );
         bValid = bValid && checkLength( cognome, "cognome", 1, 16 );
 
          bValid = bValid && checkRegexp( name, /^([a-zA-Z ])+$/, "Sono consentite solo lettere" );
   
          bValid = bValid && checkRegexp( tel, /^[0-9]{9}/, "Sono consentite solo numeri" );
          bValid = bValid && checkRegexp( cognome, /^([a-zA-Z ])+$/, "Sono consentite solo lettere" );
 
          if ( bValid ) {
            $( "#users tbody" ).append( "<tr>" +
 "<td class='prova'><input class='elimina'type='checkbox'></td>" + // <----------creazione checkbox in maniera dinamica man mano che si riempie la tabella
              "<td>" + name.val() + "</td>" +
 "<td>" + cognome.val() + "</td>" +
              "<td>" + tel.val() + "</td>" +
 "<td>" + data.val() + "</td>" +
 "<td><button onclick='deleteRow(this)'>Cancella Contatto</button></td>" +
            "</tr>" );
            $( this ).dialog( "close" );
          }
        },
        Chiudi: function() {
          $( this ).dialog( "close" );
        }
      },
  hide: {
effect: "explode",
duration: 1000
},
      close: function() {
        allFields.val( "" ).removeClass( "ui-state-error" );
      }
    });
 
    $( "#create-user" )
      .button()
      .click(function() {
        $( "#dialog-form" ).dialog( "open" );
      });
  });
  
  $(function() {
      $( "#open-event" ).tooltip({
      show: null,
      position: {
        my: "left top",
        at: "left bottom"
      },
      open: function( event, ui ) {
        ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast" );
      }
    });
});
//funzione trova
$('#Trova').click(function () {
     PulisciRubrica('users');
    var valore = $('.InpTxt1').val();  //document.Rubrica.campo.value;
    var table = $('#users');
    var celle = $('td');
    var contatore = 0;
    for (var i = 0; i < celle.length; i++) {
        if (celle[i].innerHTML == valore) {
html=('<p></p> <span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span><p>Ecco il to numero: </p>' + celle[i + 1].innerHTML);
$( "#risultato" ).html("");
$( "#risultato" ).html(html);
$( "#risultato" ).dialog( "open" );
celle[i].className = 'trovato';
       }
    }
   });
 
function PulisciRubrica(){
    var table = $('users');
    var celle = $('td');
    for (var i = 0; i < celle.length; i++) {
        celle[i].className = 'default';
    }

//tasto cerca 
$( "#risultato" ).dialog({
 autoOpen: false,
  buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
  });

//data di nascita
$(function() {
    $( "#datepicker" ).datepicker();
    });


/*$("#btnChecked").click(function(){
          $('td.GarClaCheck').each(function(){
                if ($(this).find('input.GarClaCheckBox:not(:checked)').length == 1) {
                      $(this).parent().toggle();                   
                }
          });
   });
*/
//conferma cancellazione
$(function() {
    $( "#dialog-confirm" ).dialog({
 autoOpen: false,
      height:140,
      modal: true,
      buttons: {
        "Delete all items": function() {
         // <----------inserire qui la funzione di cancellazione checkbox selezionati
        },
        Cancel: function() {
          $('input.checkbox:checked').parents('td').empty().remove();
        }
      }
    });
  });

  $( "#Elimina" ).click(function() {
      $( "#dialog-confirm" ).dialog( "open" );
    });
  
  
  
  });
  

//funzione javascript
 function deleteRow(r)
{
var i = r.parentNode.parentNode.rowIndex;
document.getElementById("users").deleteRow(i);

};

   

    vi prego help me !