Mam taki skrypt:
Kod
<html>
<head>
<script language="javascript" type="text/javascript">
function flip( rid ) {
document.getElementById(rid).style.display = document.getElementById(rid).style.display == 'none' ? 'block' : 'none'
}
</script>
<script>
window.onload = function(){
var el = document.getElementById('checkb').getElementsByTagName('input');
for(var i = 0; i < el.length; ++i)
{
if(el[i].type == 'checkbox')
{
el[i].onclick = function(){
this.parentNode.parentNode.style.background = this.checked?'red':'#FFF';
}
}
}
}
</script>
</head>
<body>
<form action="" method="post">
<div id="checkb">
<table border=1>
<tr>
<th>Chk</th><th>Nazwa</th><th>Nazwa</th><th>Data</th>
</tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="0" /></td><td>Wiersz 1</td><td>cccccccccccc</td><td>20:45 12.12.1998</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="1" /></td><td>Wiersz 2</td><td>wwwwwwwwwwww</td><td>16:34 10.02.2008</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="2" /></td><td>Wiersz 3</td><td>tttttttttttt</td><td>12:03 11.11.2007</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="3" /></td><td>Wiersz 4</td><td>aaaaaaaaaaaa</td><td>08:23 08.04.2006</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="4" /></td><td>Wiersz 5</td><td>bbbbbbbbbbbb</td><td>05:45 12.04.2008</td></tr>
</table>
</div>
<p><input type="submit" /></p>
<?php
var_dump($_POST['do_wyslania']);
?>
</form>
<head>
<script language="javascript" type="text/javascript">
function flip( rid ) {
document.getElementById(rid).style.display = document.getElementById(rid).style.display == 'none' ? 'block' : 'none'
}
</script>
<script>
window.onload = function(){
var el = document.getElementById('checkb').getElementsByTagName('input');
for(var i = 0; i < el.length; ++i)
{
if(el[i].type == 'checkbox')
{
el[i].onclick = function(){
this.parentNode.parentNode.style.background = this.checked?'red':'#FFF';
}
}
}
}
</script>
</head>
<body>
<form action="" method="post">
<div id="checkb">
<table border=1>
<tr>
<th>Chk</th><th>Nazwa</th><th>Nazwa</th><th>Data</th>
</tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="0" /></td><td>Wiersz 1</td><td>cccccccccccc</td><td>20:45 12.12.1998</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="1" /></td><td>Wiersz 2</td><td>wwwwwwwwwwww</td><td>16:34 10.02.2008</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="2" /></td><td>Wiersz 3</td><td>tttttttttttt</td><td>12:03 11.11.2007</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="3" /></td><td>Wiersz 4</td><td>aaaaaaaaaaaa</td><td>08:23 08.04.2006</td></tr>
<tr><td><input type="checkbox" name="do_wyslania[]" value="4" /></td><td>Wiersz 5</td><td>bbbbbbbbbbbb</td><td>05:45 12.04.2008</td></tr>
</table>
</div>
<p><input type="submit" /></p>
<?php
var_dump($_POST['do_wyslania']);
?>
</form>
Ten skrypt ma za zadanie po wybraniu wierszy checkboxem i ich podświetleniu przenosić do następnej strony.
Ale nie wiem czy jest dobrze napisany.
On ma mieć podobne działanie jak np. na poczcie wp.pl, w której wybiera się za pomocą checkboxsów wiersze a następnie po naciśnięciu przycisku usuń znikają zaznaczone wiersz, ale pozostałe są nadal tak jak nie zmienia się strona. U mnie ma być wybieranie wierszy, zamiast ich usuwania, w wyniku zaznaczenia checkboxów i ich podświetlenia.
Proszę o pomoc
Pozdrawiam