弹出层

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="弹出Div.aspx.cs" Inherits="WebLibrary.JS.弹出Div" %>
<!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>Untitled Page</title>
    <script language="javascript" type="text/javascript">
 
function getTop(e){ 
var offset=e.offsetTop; 
if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
return offset; 
}
 function findValue1(ddd){     
 
 var element=document.getElementById(ddd);
 
 document.getElementById("typediv1").style.visibility="visible";//显示
  document.getElementById('typediv1').innerHTML =ddd;
  document.getElementById("typediv1").style.top=getTop(element) ;
  document.getElementById("typediv1").style.left=event.x;
                                
        }
        
        function findValue2( ){       
   document.getElementById("typediv1").style.visibility="hidden";//隐藏 
                                               
        }
           
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="typediv1" style="visibility: hidden; z-index: 100; left: 25%; right: 25%;
        position: absolute; text-align: center; 50%; height: 120px; border-right: #009900 1px solid;
        border-top: #009900 1px solid; border-left: #009900 1px solid; border-bottom: #009900 1px solid;
        background-color: #f9fff6;">
         </div>
    <div>
    <asp:Label ID="lblTest" runat="server" onmouseleave="findValue2()" onmouseover="findValue1('lblTest')" Text="移动鼠标"></asp:Label>
    </div>
    </form>
</body>
</html>
原文地址:https://www.cnblogs.com/TNTZWC/p/1951416.html