CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

在调整单元格宽度时,如果单元格内有汉字或多个单词长度>tdwidth时,会出现自动换行,即使<td nwrap>,我现在必须<td><span nowrap>...</s

楼主gen2(踏雪观月)2003-12-02 20:39:13 在 Web 开发 / JavaScript 提问

在调整单元格宽度时,如果单元格内有汉字或多个单词,会出现自动换行!  
  即使<td   nwrap>,我现在必须<td><span   nowrap>...</span></td>  
  若我的表格是20*100则在表格初始化时要插入2000个元素,感觉很不科学,,请问有何解决办法? 问题点数:0、回复次数:8Top

1 楼net_lover(【孟子E章】)回复于 2003-12-02 20:43:53 得分 0

<td><nobr></nobr></td>Top

2 楼gen2(踏雪观月)回复于 2003-12-02 20:57:20 得分 0

这不是我想要的,这与我上面说的方法没什么两样呀!依然要插入2000个元素!如果我在htc里面加上这个别人不是要用tbUniqeID.rows[i].cells[j].children[0]才能访问到原来tbUniqeID.rows[i].cells[j]的内容?Top

3 楼yeefly(丰水犁)回复于 2003-12-02 21:12:37 得分 0

Care   should   be   taken   when   the   noWrap   property   is   used   in   conjunction   with   the   width   attribute   of   table   or   td   elements.  
   
  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.  
   
  If   a   td   element   has   its   noWrap   set   to   true   and   the   WIDTH   attribute   of   its   table   element   is   set   to   a   smaller   dimension   than   the   rendered   content   of   the   td   element,   wordwrap   does   not   occur.   In   this   case,   the   noWrap   setting   takes   precedence   over   the   WIDTH   attribute.  
   
   
  因此你的   td   不能设置宽度  
  如果你在做datagrid效果   可以设置table.style.tableLayout="fixed"  
  Top

4 楼alexzhang00(三角猫)回复于 2003-12-02 21:22:39 得分 0

<table   style="word-break:break-all">  
  Top

5 楼gen2(踏雪观月)回复于 2003-12-02 21:53:28 得分 0

我是希望它不自动换行!!  
  如果<table   style="word-break:keep-all">如果两个单词间有空格,单元格内容还是自动换行了,难道真的只有在TD里加上<span   nowrap>之类了吗?  
  Top

6 楼gen2(踏雪观月)回复于 2003-12-02 22:01:48 得分 0

table.style.tableLayout="fixed"  
  table.style.workBreak="keep-all"  
  已设!!Top

7 楼gen2(踏雪观月)回复于 2003-12-03 10:25:58 得分 0

upTop

8 楼xuzuning(唠叨)回复于 2003-12-03 11:57:48 得分 0

你是想让多出来的不显示吗?Top

相关问题

  • nowrap如何使用?
  • 请问 <td nowrap rowspan=2>是什么意思?
  • 急,请帮忙!一定给分!DIV标记和nowrap
  • 在添加动态单元格的时候,nowrap属性为什么添加不进去呢??请指点

关键词

  • cell
  • td
  • 单元格
  • 宽度
  • 单词
  • nowrap
  • 换行
  • width attribute
  • td element
  • property

得分解答快速导航

  • 帖主:gen2

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo