扩大
缩小

table或者列表中超出的字用省略号代替的方法(支持IE6)

样式:

.autocut
{
    width: 150px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    -icab-text-overflow: ellipsis;
    -khtml-text-overflow: ellipsis;
    -moz-text-overflow: ellipsis;
    -webkit-text-overflow: ellipsis;
}

HTML代码:

 <tr align="center">
                    <td>
                        <input type="checkbox" name="SonCheck" value="<%#Eval("ID").ToString()%>" />
                    </td>
                    <td>
                        &nbsp;
                        <%#Eval("StreetName")%>
                    </td>
                    <td>
                        &nbsp;
                        <%#Eval("VillageName")%>
                    </td>
                    <td>
                      //此处添加省略号的代码                       
                       <div class="autocut"> &nbsp;<%#Eval("DesignTitle")%></div> 
                    </td>
                    <td>
                        &nbsp;
                        <%#Nbsfj.Xxcj.Web.AppCode.Tools.ParseDate(Eval("DesignTime").ToString())%>
                    </td>
                    <td>
                        &nbsp;
                        <img src="http://www.cnblogs.com/App_Themes/Default/images/edt.gif" /><a name='editBtn' value="<%#Eval("ID")%>"
                            href="javascript:void(0)">编辑</a>&nbsp;&nbsp;<img src="http://www.cnblogs.com/App_Themes/Default/images/del.gif" /><a
                                name="delBtn" value="<%#Eval("ID")%>" href="javascript:void(0)">删除</a>
                    </td>
                </tr>

IE6下测试过也没问题

posted @ 2013-01-16 16:50  翟中龙  阅读(380)  评论(0编辑  收藏  举报