源代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ButtonControl._Default" %>
<html>
<head runat="server">    <title>未命名頁面</title>
         <script language ="javascript" type ="text/javascript" src="ButttonControl.js"></script>
         <link href="ButtonControl.css" type="text/css"  rel="stylesheet"/>
</head>
<body>
    <form id="form1" runat="server">
    <table  cellpadding="0" cellspacing="0"width="100%" >
    <tr>
    <td id ="tdSEL" runat ="server" style="width:5%">
     <asp:Button ID="btnList" runat="server"  CssClass="btnLink"  Text="button列表" OnClientClick="return false;"  />
    
    </td>
     <td id="td_pel" width="83%">
     <asp:Button ID="btn" runat="server" CssClass="btnLink" Text="測試"
             />
     </td>
         </tr>
    </table>
    </form>
</body>
</html>

后台

 

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Xml.Linq;

namespace ButtonControl
{
    public partial class _Default : System.Web.UI.Page
    {
        HtmlGenericControl divControl = new HtmlGenericControl();
        HtmlTable tabOtherSys =new HtmlTable();
        HtmlTableRow   tRow =new HtmlTableRow();
        HtmlTableCell  tCell =new HtmlTableCell();
        Button btn1 = new Button();
        Button btn2 = new Button();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.divControl.ID = "divBtnSel";
            this.divControl.Style.Add("position", "absolute");
            this.divControl.Style.Add("display", "none");
            this.divControl.Style.Add("z-Index", "999999");
            this.divControl.Style.Add("vertical-align", "top");
            this.tdSEL.Attributes.Add("onmouseover", "FnShowbtnSelect(this);");
            this.tdSEL.Attributes.Add("onmouseout", "HidebtnSelect();");
            this.tdSEL.Controls.Add(divControl);
            this.tabOtherSys.ID = "tabOtherSys";
            this.tabOtherSys.CellPadding = 0;
            this.tabOtherSys.CellSpacing = 0;
            this.tabOtherSys.Border = 1;
            this.tabOtherSys.BorderColor = "#CCCCCC";

            for (int i = 0; i <= 2; i++)
            {
                tRow = new HtmlTableRow();
                tCell = new HtmlTableCell();
                if (i ==1)
                {
                    btn1.ID = "btnAdd";
                    btn1.Text = "測試第一哥";
                    btn1.CssClass = "btnHideLink";
                    this.btn1.Click += new EventHandler(btn1_Click);
                    tCell.Controls.Add(btn1);
              
                }
                if (i == 2)
                {
                    btn2.ID = "btnAdd2";
                    btn2.Text = "測試第而哥";
                    btn2.CssClass = "btnHideLink";
                    this.btn2.Click += new EventHandler(btn1_Click);
                    tCell.Controls.Add(btn2);
                }
           
                this.tRow.Cells.Add(tCell);
                this.tabOtherSys.Rows.Add(tRow);
            }
            this.divControl.Controls.Add(tabOtherSys);
        }

        protected void btn1_Click(object sender, EventArgs e)
        {
            this.Page.Title = "歡迎";
        }

     
    }
}

JS:

function FnShowbtnSelect(obj1)

    //取得控件位置
   var oBndRct =obj1.getBoundingClientRect();
    var xel, yel;
 xel = oBndRct.left;
 yel = oBndRct.bottom; 
 if (document.all('divBtnSel')!=null){
        var objDiv=document.all('divBtnSel');
        document.all('btnList').className="btnHover";
        objDiv.style.top=yel-5;
        objDiv.style.left=xel-5;
        objDiv.style.display="";
 }
}

function HidebtnSelect(){
    if (document.all('divBtnSel')!=null)
    {
        var objDiv=document.all('divBtnSel');
        objDiv.style.display="none";
        document.all('btnList').className="btnLink";
   }
}