Non posso mettere il link alla pagina perchè è locale.
La funzione che ho fatto è questa.
codice:
function deleteNews() {
var chek = document.news.elements['notizia[]'];
var cheks = 0;
for (var i=0; i<chek.length; i++) {
if(chek[i].checked) cheks++
}
if (cheks == 0) {
alert("Non hai selezionato alcuna notizia");
return false;
}
else {
var asd = confirm('Sicuro che vuoi eliminare le notizie selezionate?');
if (asd) {
document.news.action="?ID=news;pID=delete";
document.news.submit();
return true;
}
else {
return false;
}
}
}
Il tag form è questo
<form name="news" method="post">
e i checkbox vengono creati così
<input type="checkbox" name="notizia[]" value="<?=$notizia->IDnews?>" />