表字段内容太长,怎么显示才好看???

printf_2012 2010-08-03 02:51:48
在显示上出的问题,就是表字段内容太长,把表给撑的变形了,例如像那些图片链接字段内容,还有图片名称,都很长,大家有什么好的的方法吗?比如:截取内容的一部分,鼠标放在上面又可以显示全部内容!这个怎么做呢?
...全文
696 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhzhy917 2010-08-03
  • 打赏
  • 举报
回复
直接加一个title属性就行了
huangliqiong 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 dongqdonglin 的回复:]
这个 简单 用 span
[/Quote]


这个貌似不能出现提示
能不能做出这中效果,按下提示能到图片的显示地址
跟着Mic学架构 2010-08-03
  • 打赏
  • 举报
回复
给我满分吧。 绝对符合你的要求

.newsInfo:hover {
background: #eee;
color: #333;
z-index: 999;
}
.newsInfo {
color:black;
position: relative;
z-index: 0;
}
.newsInfo span {
display: none;
}
/*设置正常下的span为隐藏状态*/
.newsInfo:hover span {
display: block;
position: absolute;
min-width:400px;
top: 28px;
left:100px;
border: 1px solid #cccccc;
background: #fff;
color: #333;
padding: 5px;
text-align: left;
overflow: hidden;
}

.newInfoTruncation {
width:300px;
white-space:nowrap;
word-break:keep-all;
overflow:hidden;
text-overflow:ellipsis;
}


<html>
<head>
<link href="index.css" rel="Stylesheet" type="text/css" />
</head>
<body>
<div>
<a href="#"class="newsInfo">
<div class="newInfoTruncation">
2010年度深圳市因私出入境中介机构信息公布 28家出入境中介机构通过审核
</div>
<span>
2010年度深圳市因私出入境中介机构信息公布 28家出入境中介机构通过审核
</span>
</a>
</div>
</body>
</html>
printf_2012 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 dongqdonglin 的回复:]
subStForTable("asdasdadadasdadada",5) 直接调用 在你想显示的地方 放入第一个参数 你要现实的 文字 第二个参数 要截取的昌都
[/Quote]
知道怎么传参数,但是还是不会调用,怎么个直接调用,我的表在上面,你帮我改下,实在是不明白!谢谢了
dongqdonglin 2010-08-03
  • 打赏
  • 举报
回复
subStForTable("asdasdadadasdadada",5) 直接调用 在你想显示的地方 放入第一个参数 你要现实的 文字 第二个参数 要截取的昌都
printf_2012 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 dongqdonglin 的回复:]
JScript code

function subStForTable(str,strLen){
var sb ="";
if(str.length>strLen){
sb +='<span title ="'+str+'">'+str.substr(0,strLen)+……
[/Quote]
表单怎么调你这个JS方法呢?参数该怎么传呢?

<table width="610" height="25" border="0" cellpadding="0" cellspacing="0" background="image/bg_02.jpg">
<tr>
<td><div align="center"><strong>网站广告信息的查询</strong></div></td>
</tr>
</table>
<br>
<table width="100%" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="CCCCCC">
<tr>
<td width="15%" height="25"><div align="center">广告编号</div></td>
<td width="20%"><div align="center">图片名称</div></td>
<td width="25%"><div align="center">图片地址</div></td>
<td width="28%"><div align="center">广告链接</div></td>
<td width="35%"><div align="center">操作</div></td>
</tr>
<% for(int i=start;i<over;i++){
AdvertisementForm adform=(AdvertisementForm)list.get(i);
%>
<tr bgcolor="#FFFFFF">
<td height="5"><div align="center"><%=adform.getId() %></div></td>
<td><div align="center"><%=adform.getImageName() %></div></td>
<td><div align="center"><%=adform.getImagePath() %></div></td>
<td><div align="center"><%=adform.getAdPageUrl() %></div></td>
<td><div align="center">
<a href="advertisementAction.do?action=2&id=<%=adform.getId() %>">修改</a>   
<a href="javascript:deleteAdver('<%=adform.getId()%>')">删除</a>

</div></td>
<%}%> </tr>
</table>
yinzisheng 2010-08-03
  • 打赏
  • 举报
回复
鼠标放上面显示内容的属性是 title;字串截取 一般用fn标签
dongqdonglin 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xinlan1022 的回复:]
引用 7 楼 liujun822 的回复:

用td的中一个title属性就可以完成
<html>
<body>
<table>
<tr>
<td title="我是一个中国人我爱中国">我是一个............</td>
</tr>
</table>
</body>
</html>
相关代码



就使用这种方法
[/Quote]

这样控制要显示的长度不方便
xinlan1022 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 liujun822 的回复:]

用td的中一个title属性就可以完成
<html>
<body>
<table>
<tr>
<td title="我是一个中国人我爱中国">我是一个............</td>
</tr>
</table>
</body>
</html>
相关代码
[/Quote]


就使用这种方法
liujun822 2010-08-03
  • 打赏
  • 举报
回复
用td的中一个title属性就可以完成
<html>
<body>
<table>
<tr>
<td title="我是一个中国人我爱中国">我是一个............</td>
</tr>
</table>
</body>
</html>
相关代码
dongqdonglin 2010-08-03
  • 打赏
  • 举报
回复

function subStForTable(str,strLen){
var sb ="";
if(str.length>strLen){
sb +='<span title ="'+str+'">'+str.substr(0,strLen)+'...</span>';
}else{
sb +='<span title ="'+str+'">'+str+'</span>';
}
return sb;
}


我写的一个js的 截取方法
dongqdonglin 2010-08-03
  • 打赏
  • 举报
回复
这个 简单 用 span
跑跑鱼 2010-08-03
  • 打赏
  • 举报
回复
没人呢,帮顶
printf_2012 2010-08-03
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 g3253769 的回复:]
帮顶。。··关注
[/Quote]
3Q
g3253769 2010-08-03
  • 打赏
  • 举报
回复
帮顶。。··关注
printf_2012 2010-08-03
  • 打赏
  • 举报
回复
没人吗?快来啊

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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