Das Formular über die gesamte Tabelle hinweg hat aber Vorteile:
Bevor die Frage kommt: Ja. Dass ist ein "Schnellschrieb" für diesen Thread.
<!DOCTYPE html>
<html>
<head>
<title>Table - Multiform</title>
<style>
.jsOnly_inline { display:none; }
</style>
</head>
<body>
<form method="POST" action="https://home.fastix.org/phpinfo.php#_POST">
<button type="button" class="jsOnly_inline" name="selectAll" id="selectAll" value="1">Alle auswählen</button>
<button name="deleteSelected" id="deleteSelected" value="1">Gewählte Löschen</button>
<table>
<tr>
<td>
<input class="MultiSelectors" name="selector[1]" type="checkbox" id="selections[1">
</td>
<td>
Daten 1
</td>
<td>
<button name="edit" value="1">edit</button>
<button name="delete" value="1">delete</button>
</td>
</tr>
<tr>
<td>
<input class="MultiSelectors" name="selector[2]" type="checkbox" name="" id="selections[2]">
</td>
<td>
Daten 2
</td>
<td>
<button name="edit" value="2">edit</button>
<button name="delete" value="2">delete</button>
</td>
</tr>
</table>
</form>
<script>
var ar = document.getElementsByClassName('jsOnly_inline');
for (var i = 0; i < ar.length; i++) {
ar[i].style.display="inline"
}
function selectAllMultiSelectors() {
var ar = document.getElementsByClassName('MultiSelectors');
for (var i = 0; i < ar.length; i++) {
ar[i].checked=true;
}
var o = document.getElementById('selectAll');
o.removeEventListener("click", selectAllMultiSelectors, true );
o.addEventListener("click", unSelectAllMultiSelectors, true );
o.innerHTML="Auswahl aufheben";
}
function unSelectAllMultiSelectors() {
var ar = document.getElementsByClassName('MultiSelectors');
for (var i = 0; i < ar.length; i++) {
ar[i].checked=false;
}
var o = document.getElementById('selectAll');
o.removeEventListener("click", unSelectAllMultiSelectors, true );
o.addEventListener("click", selectAllMultiSelectors, true );
o.innerHTML="alle auswählen";
}
var o = document.getElementById('selectAll');
o.addEventListener("click", selectAllMultiSelectors, true );
</script>
</body>
</html>