日期:2014-05-17 浏览次数:20438 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="js/Jquery/jquery-1.5.1.js"> </script> </head> <body> <div id="bookinfor"> <div> <img id="bookpic" alt="" /> </div> <div id="bookxx"> </div> </div> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server"> </asp:GridView> </form> <script language="javascript" type="text/javascript"> function getTr(cControl){ if (cControl.tagName == "TABLE") { return null; } if (cControl.tagName == "TR") { return cControl } return getTr(cControl.parentElement); } $(document).ready(function(){ $("#bookinfor").hide(); $("#<%=GridView1.ClientID %>").hover(function(){ var trObj = getTr(arguments[0].srcElement); if (trObj != undefined) { var oCells = trObj.cells; // 可以取到每一行的内容了 var o = oCells[0].innerHTML; $("#bookinfor").show(); $("#bookxx").text(oCells[0].innerHTML); } }, function(){ $("#bookinfor").hide(); }); }); </script> </body> </html>