鼠标滑过按钮显示详细信息

晨曦之光 发布于 2012/05/16 17:14
阅读 151
收藏 0

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>

<!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>
function showdiv(div){
div.className='divshow';
div.style.left=event.x+document.body.scrollLeft-div.width-5;
div.style.top=event.y+document.body.scrollTop+20;
}

</script>
<style type="text/css">
    .titlediv {
font-family: "Verdana", "Arial", "Helvetica", "sans-serif";
font-size: 12px;
font-weight: normal;
word-break:break-all;
filter: Alpha(Opacity=80, FinishOpacity=30, Style=1, StartX=1, StartY=1, FinishX=100, FinishY=100);
}
.divshow {
display: block;
position:absolute;
width:150px; z-index:1
}
.divhidden {
display: none;
position:absolute;
width:150px; z-index:1
}
</style>
</head>
<body>
    <form id="form1" runat="server">
                           <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" onmousemove="javascript:showdiv(div1);" onmouseout="javascript:div1.className='divhidden';" />
                   <div id="div1" class="divhidden" width="200">
        <table width="200" border="1" cellpadding="5" cellspacing="0" bordercolor="#666666"
            bgcolor="#e9e9e9" class="titlediv" style="border-collapse: collapse">
            <tr>
                <td bgcolor="#f1f1f1">
                    显示标题
                </td>
            </tr>
            <tr>
                <td>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>
                                显示的内容
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>


原文链接:http://blog.csdn.net/maji9370/article/details/5701994
加载中
返回顶部
顶部