我正在制作一个表格,我在各个页面中显示“X”行数据......这个“X”行可能是 10、20 或 30,所以我做了这样的选择
<select id="lala" name="lal">
<option value="10">10</option>
<option selected="selected" value="20">20</option>
<option value="30">30</option>
</select>
我的脚本(我正在使用 mootools)是这个
window.addEvent('domready', function(){
$('lala').addEvent(
'change', function() {
alert('Has cambiado el campo select');
});
});
我的问题是该事件在第一页和最后一页中不起作用,但在其余页面中起作用……例如:我有 10 页,在第 1 页和第 10 页中,事件什么也不做,在第 2 页和第 9 页中起作用。 ...
注意:对不起我的英语不好
编辑:这是我的桌子(一部分但很重要)
<table id="rounded-corner" width="100%">
<thead>
<tr>
<th class="rounded-r">Dia <img class="difcursor" src="Imagenes/<?php echo $a ?>.png" id="ordendia" /></th>
<th>Hora</th>
<th>Desde <img class="difcursor" src="Imagenes/<?php echo $b ?>.png" id="ordensrc" /></th>
<th>Destino <img class="difcursor" src="Imagenes/<?php echo $c ?>.png" id="ordendst" /></th>
<th>Estado <img class="difcursor" src="Imagenes/<?php echo $d ?>.png" id="ordenest" /></th>
<th class="rounded-l">Duracion <img class="difcursor" src="Imagenes/<?php echo $e ?>.png" id="ordendur" /></th>
</tr>
</thead>
$consulta2 = "SELECT * FROM table ORDER BY $bot $orden LIMIT $g, $cantm";
$result2 = $dbh->prepare($consulta2);
$result2->execute();
foreach ($result2 as $valor) {
$separar = explode(' ',$valor['calldate']);
$dia = explode('-',$separar[0]);
switch ($valor['disposition']){
case "ANSWERED":
if ($valor['lastapp']=="VoiceMail"){
$estado="Buzon de Voz";
}
else{
$estado="Contestado";
}
break;
case "NO ANSWER":
$estado="No Contestado";
break;
case "BUSY":
$estado="Ocupado";
break;
}
$minutos = 0;
$horas = 0;
while ($valor['duration'] > 60){
$minutos++;
$valor['duration'] -= 60;
}
while ($minutos > 60){
$horas++;
$minutos -=60;
}
if ($valor['duration'] < 10){
$segundos = "0".$valor['duration'];
}
else {
$segundos = $valor['duration'];
}
if ($minutos < 10){
$minutos = "0".$minutos;
}
if ($horas < 10){
$horas = "0".$horas;
}
?>
<tr>
<td><?php echo "$dia[2]-$dia[1]-$dia[0]"; ?></td>
<td><?php echo "$separar[1]"; ?></td>
<td><?php echo "$valor[src]"; ?></td>
<td><?php echo "$valor[dst]"; ?></td>
<td><?php echo "$estado"; ?></td>
<td><?php echo "$horas : $minutos : $segundos"; ?></td>
</tr>
<tfoot>
<tr>
<td colspan=5 class="rounded-foot-left"><a href="lrecibidas.php?call=<?php echo $opcion; ?>&bot=<?php echo $bot; ?>&orden=<?php echo $orden; ?>&bot2=primera&pag=<?php echo $act; ?>&cantm=<?php echo $cantm; ?>"><?php echo $imag; ?></a>
<a href="lrecibidas.php?call=<?php echo $opcion; ?>&bot=<?php echo $bot; ?>&orden=<?php echo $orden; ?>&bot2=atras&pag=<?php echo $act; ?>&g=<?php echo $g; ?>&cantm=<?php echo $cantm; ?>&g=<?php echo $g; ?>"><?php echo $imag2; ?></a>
Pagina <?php echo $act ?>/<?php echo $cantp ?>
<a href="lrecibidas.php?call=<?php echo $opcion; ?>&bot=<?php echo $bot; ?>&orden=<?php echo $orden; ?>&bot2=adelante&pag=<?php echo $act; ?>&g=<?php echo $g; ?>&cantm=<?php echo $cantm; ?>"><?php echo $imag3; ?></a>
<a href="lrecibidas.php?call=<?php echo $opcion; ?>&bot=<?php echo $bot; ?>&orden=<?php echo $orden; ?>&bot2=ultima&pag=<?php echo $act; ?>&cantm=<?php echo $cantm; ?>&g=<?php echo $g; ?>"><?php echo $imag4; ?></a>
</td>
<td colspan=2 class="rounded-foot-right">
<form>
<select id="lala" name="lal">
<option value="10">10</option>
<option selected="selected" value="20">20</option>
<option value="30">30</option>
</select>
</form>
</td>
</tr>
</tfoot>
</table>
这些图像是从一个页面到另一个页面的箭头(如果有人知道如何在不使用 URL 的情况下将变量从 php 传递到 JS,我全神贯注 :))问题是我正在使用 javascript 来订购表格我想要,并且适用于所有页面...
做分页我用这个:
$result = $dbh->query("SELECT count(*) AS cantidad FROM table");
$row = $result->fetch(PDO::FETCH_ASSOC);
while ($row["cantidad"]>$cantm){
++ $cantp;
$row["cantidad"]-=$cantm;
}
++ $cantp;
switch ($bot2){
case "primera":
$g = 0;
$act = 1;
break;
case "atras":
$g -= $cantm;
$act -= 1;
break;
case "adelante":
$g += $cantm;
$act += 1;
break;
case "ultima":
$aux = $cantp - 1;
$g = $aux * $cantm;
$act = $cantp;
break;