如何在td内隐藏超过长度内容,并用expression显示。。。

ShadowInWind 2008-04-10 01:38:45
CSS接触不多,找了几段自己改的。哪位高手帮忙指点下,我哪里有错误。我要实现器械编号那一栏,超过60px就隐藏,并且鼠标移上去可以提示出来。

<style>
#newstd .ellipsis_row{width:60px}
.ellipsis_row{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
wzy:expression( this.title=this.offsetWidth<this.children(0).offsetWidth?this.children(0).innerText:'',
this.style.wzy=''
);
background-color=#b0b0b0;
}

.tablebody1 {
background-color:#ffffff;
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
text-align:left;
border-bottom-width:0;
color:#666666;
padding: 0;
border-left:1 solid #dedede;
margin-top: 0;
margin-right: 0px;
margin-bottom: 0;
margin-left: 0px;
}
</style>

<table class="tablebody1" id="losingtable" style="WIDTH: 439px; HEIGHT: 10px" cellSpacing="0"
cellPadding="0" width="439" border="0">
<tr class="head2">
<td id="newstd" width="60" class="ellipsis_row"><span><span>器械编号</span></span></td>
<td width="70"><span>器械名称</span></td>
<td width="60"><span>数量</span></td>
<td width="60"><span>库房名称</span></td>
<td width="159"><span>报损原因</span></td>
<td width="30"><span>取消</span></td>
</tr>
</table>
...全文
310 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
myvicy 2008-04-10
  • 打赏
  • 举报
回复
overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
ShadowInWind 2008-04-10
  • 打赏
  • 举报
回复
搞定了,我class="ellipsis_row" 放错位置了,应该放span里。。。谢谢楼上两位。
stkim 2008-04-10
  • 打赏
  • 举报
回复
<td id="newstd" width="60" class="ellipsis_row"> <span> <span>器械编号 </span> </span> </td>
==> <td id="newstd" width="60" class="ellipsis_row" title="器械编号的实际值"> <span> <span>器械编号 </span> </span> </td>

.ellipsis_row{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
wzy:expression( this.title=this.offsetWidth <this.children(0).offsetWidth?this.children(0).innerText:'',
this.style.wzy=''
);
background-color=#b0b0b0;
}

-- 这个错了 overflow和wzy都不对

background-color=#b0b0b0; 语法错误
ShadowInWind 2008-04-10
  • 打赏
  • 举报
回复
饿,感谢1楼的前辈支招啊,能不能给一段函数看看?
  • 打赏
  • 举报
回复
CSS接触不多,找了几段自己改的。哪位高手帮忙指点下,我哪里有错误。我要实现器械编号那一栏,超过60px就隐藏,并且鼠标移上去可以提示出来。
这样的功能无须CSS样式,只需要函数截取个数,然后使用title属性就可以了达到鼠标移上去可以提示出来

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧