xiyurui

路靠自己走,也靠运气. 但能不能抓住运气靠自己的手. 所以.自己的手和自己的脚,是最值得依赖的. 少壮不努力,老大徒伤悲!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

脚本代码
        function Show(sea, comment)
        {
             //获得鼠标的X轴的坐标
            x = event.clientX + document.body.scrollLeft  ;        
            //获得鼠标的Y轴的坐标
            y = event.clientY + document.body.scrollTop  ;
            //显示弹出窗体
            Popup.style.display="block";
            //设置窗体的X,Y轴的坐标
            Popup.style.left = x;
             Popup.style.top = y;
            document.getElementById("td1").innerText="缺勤人员及原因:"+sea;
            document.getElementById("td2").innerText="会议主要内容:"+comment;   
        }
         //隐藏弹出窗体
         function Hide()
        {
            Popup.style.display="none";
        }

<div class="font_green" style="DISPLAY: inline; Z-INDEX: 101; LEFT: 584px; WIDTH: 88px; POSITION: absolute; TOP: 264px; HEIGHT: 72px"  ms_positioning="FlowLayout" id="Popup">
    <table border="0" cellpadding="0" style="FONT-SIZE: x-small">
     <tr>
      <td id="td1"></td>
     </tr>
     <tr>
      <td id="td2"></td>
     </tr>
    </table>
   </div>

数据绑定事件
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
   {
    e.Item.Attributes.Add("onmouseover", "this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF';");
    e.Item.Attributes.Add("onmousemove", "Show('"+dtab.Rows[e.Item.ItemIndex+(DataGrid1.CurrentPageIndex*DataGrid1.PageSize)]["TeamMeet_AbsentName"].ToString()+"','"
     +dtab.Rows[e.Item.ItemIndex+(DataGrid1.CurrentPageIndex*DataGrid1.PageSize)]["TeamMeet_Content"].ToString()+"');");
    e.Item.Attributes.Add("onmouseout",
     "this.style.backgroundColor=this.oldcolor;Hide();"); 
   }
  }

 Popup是层
td1,td2是层里一个table的单元格