Jump to content
funbinod

styling looped rows with jquery

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...

Edited by funbinod

Share this post


Link to post
Share on other sites

what I want is not suggestions about queries..... I want suggestion on changing the style of rows onMouseOver and onMouseOut. check the jquery function at the bottom

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...