<script> $("td.TIP").mouseover(function (e) { this.myTitle = this.title; this.title = ""; var toolTip = "<div id='tooltip'>" + this.myTitle + "</div>"; $("body").append(toolTip); $("#tooltip").css({ "position": "absolute", "padding": "5px", "background": "#F0F0E8", "border": "1px gray solid", "top": (e.pageY + y) + "px", "left": (e.pageX + x) + "px" }).show(200); }).mouseout(function () { this.title = this.myTitle; $("#tooltip").remove(); }).mousemove(function (e) { $("#tooltip").css({ "background": "#F0F0E8", "padding": "5px", "border": "1px gray solid", "top": (e.pageY + y) + "px", "left": (e.pageX + x) + "px" }) }) </script>
<td class="TIP" title='<%#Eval("IntNewsContent")%>'><%# BaseClass.CheckStr(Eval("IntNewsContent"), 5)%></td>
public static string CheckStr(object strValue, int Len) //字符串截取函数,如果长度大于30,则只显示前30个字符 { return (strValue.ToString().Length > Len) ? strValue.ToString().Substring(0, Len) + ".." : strValue.ToString(); }