2个JS方法:
<script type="text/javascript">
function Show(content) {
document.getElementById("td1").innerText = "" + content;
var x = event.clientX + document.body.scrollLeft;
var y = event.clientY + document.body.scrollTop + 30;
div1.style.display = "block";
div1.style.left = x;
div1.style.top = y;
}
function Hide() {
div1.style.display = "none";
}
</script>
后台添加:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Attributes.Add("onmouseover","Show('abc');");
e.Row.Cells[0].Attributes.Add("onmouseout","Hide();");
}
}
效果:
![](http://hi.csdn.net/attachment/201107/28/0_13118235715dmX.gif)