Jump to content

styling looped rows with jquery


funbinod
 Share

Recommended Posts

I was trying to change the style of a row while I mouseover it. the rows are generated from MySQL_query and while loop. but it worked for just first row.

here is what I tried---

<style>.mouseover { background-color: #CCC; color: #FCC; border:none; width:13em; height:1.5em }</style><?while($row = mysqli_fetch_array($result))	{		echo "<tr style='text-align:center; background-color:#c99; height:2em;' id='acrow'>";		echo "<td style='width:500px;'>" . $row['name'] . "</td>";		echo "<td style='width:125px;'>" . $row['ac_type'] . " (".$row['ac_id'].")</td>";		echo "<td style='width:200px;text-align:right'>" . number_format(($row['ob']),2,'.',',') . "</td>";		echo "<td style='width:25px;'><a href="acregister.php?aid=$row[aid]&m=e" class=slink>Edit</a></td>";		echo "<td style='width:50px;'><a href="creport.php?aid=$row[aid]" class=slink>Report</a></td>";  echo "</tr>";  }?><script>$(document).ready(function(e) {//sregister	$("#acrow").mouseover(function(e) {		$("#acrow").addClass('mouseover');	})	$("#acrow").mouseout(function(e) {		$("#acrow").removeClass('mouseover');	})})</script>

please suggest me what I did mistake or there is some better option or this is not the good practice...

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...