如何将表格的行列转换?

php_wsd 2009-06-01 08:57:35
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="center">1</td>
<td align="center">2</td>
<td align="center">3</td>
</tr>
<tr>
<td height="20" align="center">4</td>
<td align="center">5</td>
<td align="center">6</td>
</tr>
</table>
这是一个2行3列的表格,现在要转换成
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="center">1</td>
<td align="center">4</td>
</tr>
<tr>
<td height="20" align="center">2</td>
<td align="center">5</td>
</tr>
<tr>
<td height="20" align="center">3</td>
<td align="center">6</td>
</tr>
</table>
这个,如何办?
...全文
144 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
已经实现
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
asp
郭大侠_ 2009-06-01
  • 打赏
  • 举报
回复
这是个很有意思的问题,不过表格行数太多就没意义了,你是想用js还是Asp?
BobHe 2009-06-01
  • 打赏
  • 举报
回复
那可能就没有办法了哦
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
由于生成第一个表格的程序太麻烦,不想在那个里面找了,所以想起来直接将表格的行列转换
BobHe 2009-06-01
  • 打赏
  • 举报
回复
你生成第一个表格的程序是什么样的?能不能在程序中找到生成的规律?
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
谢谢4楼
第一个表格的已经生成,现在要转换成第二个表格。
并且第一个表格的行列数目不能确定是多少?全部是由程序生成的,上面的二行三列只是一个例子
shenzhenNBA 2009-06-01
  • 打赏
  • 举报
回复
是用ASP完成啊?还是用JS完成?ASP完成应该更容易些吧。。。有代码不?
BobHe 2009-06-01
  • 打赏
  • 举报
回复
<%
x=3 '行
y=2 '列
Response.Write "<table width=500 border=1 cellspacing=0 cellpadding=0>"
for i=1 to x
Response.Write "<tr>"
for a=1 to y
Response.Write "<td>"
Response.Write "内容"
Response.Write "</td>"
next
'Response.Write x
Response.Write "</tr>"
next
Response.Write "</table>"
%>

这样可以不?

asp技术讨论QQ群:12579878
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
第一个表格是由我用asp代码生成的,放在变量str中,现在想使用代码将它转换成下面的代码输出
shenzhenNBA 2009-06-01
  • 打赏
  • 举报
回复
[Quote=引用楼主 wangsdong 的帖子:]
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="center">1 </td>
<td align="center">2 </td>
<td align="center">3 </td>
</tr>
<tr>
<td height="20" align="center">4 </td>
<td align="center">5 </td>
<td align="center">6 </td>
</tr>
</table>
这是一个2行3列的表格,现在要转换成
<table width="500" border…
[/Quote]

能实现不过这个比较罗嗦,。。。:(
lihan6415151528 2009-06-01
  • 打赏
  • 举报
回复
手工修改代码不行?
如果非要代码操作
那么javascript只有重新生成表格了
php_wsd 2009-06-01
  • 打赏
  • 举报
回复
BobHe 2009-06-01
  • 打赏
  • 举报
回复
怎么实现,可以给大家分享下,呵呵

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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