| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 803 人关注过本帖
标题:求助,10分钟回复,关于TD的一个属性
只看楼主 加入收藏
潇寒
Rank: 1
等 级:禁止访问
帖 子:157
专家分:0
注 册:2006-10-18
收藏
 问题点数:0 回复次数:4 
求助,10分钟回复,关于TD的一个属性

各位大侠我现在遇到一个问题就是从数据库里读数据的时候数据不自动换行一直读把表格都搞的老宽,我以前用过一个关于TD的一个属性,现在不太清楚了,各位大侠帮个忙.有没有知道的,或其它的解决办法?

sub ArticleContent(intTitleLen)
dim i,lb,strli
Response.Write "<table width=100% border=0 cellspacing=2 cellpadding=0>"
i=1
do while not rsArticle.eof
Response.Write "<TR align=""center"">"
strli=""

lb=""
lb=lb & "<TD align='left'><a href='En_ProductShow.asp?ArticleID=" & rsArticle("articleid") & "' title='" & strli &"'><img border=0 src='"& rsArticle("DefaultPicUrl") &"' width=100 height=100></a></TD>"
lb=lb & "<td width='16%'><a href='En_ProductShow.asp?ArticleID="& rsArticle("articleid") &"' target='_blank'>See</a><br><a href='javascript:eshop("& rsArticle("Product_Id") &")'>Order</a><br><div style='width:90%; height:20px; background-image:url(../img/tablebg1.gif)'>"& gotTopic(rsArticle("EnTitle"),16) &"</div></td>"
lb=lb & "<td width='71%'><a href='En_ProductShow.asp?ArticleID="& rsArticle("articleid") &"'>"& gotTopic(rsArticle("EnSpec"),100) &"</a></td>" '//要求数据自动换行的地方

lb=lb & "</TR>"

lb=lb & "<TR align=""center"">"

lb=lb & "<TD colspan='3' align='left'><hr color=#CCCCCC></TD>"

lb=lb & "</TR>"
response.write lb
rsArticle.movenext
i=i+1
if i>=MaxPerPage then exit do
loop
Response.Write "</Table>"
end sub

搜索更多相关主题的帖子: quot 数据库 属性 Response Write 
2007-05-28 19:38
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
收藏
得分:0 

我让得TD没那么个属性,你这样
[CODE]<a href='En_ProductShow.asp?ArticleID="& left(rsArticle("articleid"),21) &"'>"& gotTopic(rsArticle("EnSpec"),100) &"</a>[/CODE]

2007-05-28 20:06
guyer
Rank: 2
等 级:新手上路
威 望:5
帖 子:451
专家分:0
注 册:2007-1-19
收藏
得分:0 
style="word-break:break-all;"

用他试试

不过汉字应该都可以自动换行的

http://www./
2007-05-28 20:07
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
收藏
得分:0 

下面的是本人收藏的,你自己找一个适合你用的吧.

css之自动换行
1)对于div,p等块级元素
正常文字的换行(亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义的宽度之后自动换行
html
<div id="wrap">正常文字的换行(亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义</div>

css
<style>
#wrap{white-space:normal; width:200px; }
</style>


2).(IE浏览器)连续的英文字符和阿拉伯数字,使用word-wrap : break-word ;或者word-break:break-all;实现强制断行
<style>
#wrap{word-break:break-all; width:200px;}
</style>
或者
<style>
#wrap{word-wrap:break-word; width:200px;}
</style>

<div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>

效果:可以实现换行


3).(Firefox浏览器)连续的英文字符和阿拉伯数字的断行,Firefox的所有版本的没有解决这个问题,我们只有让超出边界的字符隐藏或者,给容器添加滚动条

<style>
#wrap{word-break:break-all; width:200px; overflow:auto;}
</style>

<div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>

效果:容器正常,内容隐藏


4)(IE浏览器)使用 table-layout:fixed;强制table的宽度,多余内容隐藏

<table style="table-layout:fixed" width="200">
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss
</td>
</tr>
</table>

效果:隐藏多余内容


5).(IE浏览器)使用 table-layout:fixed;强制table的宽度,内层td,th采用word-break : break-all;或者word-wrap : break-word ;换行

<table width="200" style="table-layout:fixed;">
<tr>
<td width="25%" style="word-break : break-all; ">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
<td style="word-wrap : break-word ;">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
</tr>
</table>

效果:可以换行


6).(Firefox浏览器)使用 table-layout:fixed;强制table的宽度,内层td,th采用word-break : break-all;或者word-wrap : break-word ;换行,使用overflow:hidden;隐藏超出内容,这里overflow:auto;无法起作用

<table style="table-layout:fixed" width="200">
<tr>
<td width="25%" style="word-break : break-all; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<td width="75%" style="word-wrap : break-word; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>

效果:隐藏多于内容


下面是上面提到的例子的效果:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>字符换行</title>
<style type="text/css">
table,td,th,div { border:1px green solid;}
code { font-family:"Courier New", Courier, monospace;}
</style>
</head>
<body>
<h1><code>div</code></h1>
<h1><code>All white-space:normal;</code></h1>
<div style="white-space:normal; width:200px;">Wordwrap still occurs in a td element that has its WIDTH attribute set to a value smaller than the unwrapped content of the cell, even if the noWrap property is set to true. Therefore, the WIDTH attribute takes precedence over the noWrap property in this scenario</div>

<h1><code>IE \ word-wrap : break-word ;</code></h1>
<div style="word-wrap : break-word ; width:200px;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<h1><code>IE \ word-break:break-all;</code></h1>
<div style="word-break:break-all;width:200px;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>

<h1><code>Firefox/ word-break:break-all; overflow:auto;</code></h1>
<div style="word-break:break-all; width:200px; overflow:auto;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<h1><code>table</code></h1>
<h1><code>table-layout:fixed;</code></h1>
<table style="table-layout:fixed" width="200">
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<h1><code>table-layout:fixed; word-break : break-all; word-wrap : break-word ;</code></h1>
<table width="200" style="table-layout:fixed;">
<tr>
<td width="25%" style="word-break : break-all; ">abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
<td style="word-wrap : break-word ;">abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<h1><code>FF \ table-layout:fixed; overflow:hidden;</code></h1>
<table style="table-layout:fixed" width="200">
<tr>
<td width="25%" style="word-break : break-all; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<td width="75%" style="word-wrap : break-word; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>
</body>
</html>

2007-05-29 09:39
潇寒
Rank: 1
等 级:禁止访问
帖 子:157
专家分:0
注 册:2006-10-18
收藏
得分:0 
谢谢了各位大侠

[url=http://www..cn] 亚洲数据[/url]
2007-05-29 14:52
快速回复:求助,10分钟回复,关于TD的一个属性
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016077 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved