vendredi 6 février 2015

document.getelementbyclassname is not affecting elements


Vote count:

0




I have the following script:



$i=1;
echo '<table>';
while($row=mysql_fetch_array){
echo '<tr class="'.$i.'">';
echo '<td>'.$row['value'].'</td>';
echo '</tr>';
$i++;
}
echo '</table>';

$i=1;
echo '<table>';
while($row=mysql_fetch_array){
echo '<tr class="'.$i.'">';
echo '<td>'.$row['value'].'</td>';
echo '</tr>';
$i++;
}
echo '</table>';
echo '<script>nr='.mysql_num_rows(query).'</script>';


Javascript:



$(document).ready(function(){
for(i=26; i<=nr; i++){
document.getElementByClassName(i).style.display='none';
}
});


As you probably figured out,i'm trying to create a pagination script.To start with,no,i dont want an already made js script , i want it to create it alone(well with some help in cases when i am blocked on some issues).The first step is to hide the other's elements starting with the 25 tr.But the problem is that the document.getelementbyclassname dont affect them...At first i used id for tr,and it worked,but only for the first table(because id must be unique,and in my case the value for the id is the same,so i used class).I can't figure out what is the problem...



asked 36 secs ago







document.getelementbyclassname is not affecting elements

Aucun commentaire:

Enregistrer un commentaire