鼠标划过显示Div层,Div层里面的信息从数据库中取出
01.<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="NET_Default" %>
02.
03.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
04.
05.<html xmlns="http://www.w3.org/1999/xhtml" >
06.<head runat="server">
07. <title>鼠标划过显示Div层,Div层里面的信息从数据库中取出</title>
08. <mce:script type="text/javascript"><!--
09. function showTip(oEvent,obj){
10. var oDiv = document.getElementById("divTip1");
11.
12. NET_Default.ReturnTable(obj,callback);
13.
14. oDiv.style.visibility="visible";
15. oDiv.style.left = oEvent.clientX-25;
16. oDiv.style.top =oEvent.clientY-35;
17. }
18. function hideTip(oEvent){
19. var oDiv = document.getElementById("divTip1");
20. oDiv.style.visibility = "hidden";
21. }
22. function callback(res)
23. {
24. if(res!=null)
25. {
26. document.getElementById("divTip1").innerHTML=res.value;
27. }
28. }
29.
30.// --></mce:script>
31.</head>
32.<body>
33. <form id="form1" runat="server">
34. <div>
35.
36. </div>
37. <asp:DataList ID="DataList1" runat="server">
38. <ItemTemplate>
39. <table>
40. <tr>
41. <td>姓名</td>
42. <td onmouseover="showTip(event,'<%#Eval("UserName") %>')" onmouseout="hideTip(event)"><%#Eval("UserName") %></td>
43. </tr>
44. </table>
45. </ItemTemplate>
46. </asp:DataList>
47. <div id="divTip1"
48. style="background:yellow; position:absolute; visibility:hidden; padding: 5px" mce_style="background:yellow; position:absolute; visibility:hidden; padding: 5px">
49. </div>
50. </form>
51.</body>
52.</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="NET_Default" %>
<!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