1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| $(document).ready(function(){
$(".up,.down").click(function(){
var row = $(this).parents("tr:first");
if ($(this).is(".up")) {
row.insertBefore(row.prev());
} else {
row.insertAfter(row.next());
}
});
});
$output .= '<table>';
$output .= '<tr>';
$output .= '<th scope="col">Name</th>';
$output .= '<th scope="col">Age</th>';
$output .= '<th scope="col">Action</th>';
$output .= '</tr>';
$i = 1;
foreach ($a as $b)
{
$output .= '<tr>';
$output .= '<td align="center"><span '.$class_color.'>'.$b["c"].'</span></td>';
$output .= '<td align="center"><span '.$class_color.'>'.$b["d"].' </span></td>';
$output .= '<td align="center"><span '.$class_color.'>'.$i.' <a href="#" class="up">up</a> / <a href="#" class="down">down</a></span></td>';
$output .= '</tr>';
$i++;
}
$output .= '</table>'; |
Partager