在表内制作表时出现奇怪的 erb 行为
我试图简单地让一个表出现在外部表的 元素内。这段代码:
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
<table border="0" class="timesList">
<tbody>
<% @time_array.each do |time| %>
<tr><%= time %></tr>
<% end %>
</tbody>
</table>
</td>
</tr>
然而,当 erb 渲染该页面的 html 时,我得到:
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
9:0010:00:11:0012:00
<table border="0" class="timesList">
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
</table>
</td>
</tr>
有谁知道如何解决这个问题?我只是错过了一些明显的东西?谢谢!
I'm trying to simply have a table appear inside a <td>
element of an outer table. This code:
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
<table border="0" class="timesList">
<tbody>
<% @time_array.each do |time| %>
<tr><%= time %></tr>
<% end %>
</tbody>
</table>
</td>
</tr>
However, when erb renders the html for this page, I get:
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td>
9:0010:00:11:0012:00
<table border="0" class="timesList">
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
</table>
</td>
</tr>
Does anyone have an idea how to fix this? I am just missing something blatantly obvious? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是因为
丢失
您的浏览器无法解析表格并将意外的文本“9:0010:00:11:0012:00”放在渲染源时的表。
I think it's because the
<td></td>
are missingYour browser failed to parse the table and put the unexpected text "9:0010:00:11:0012:00" outside the table when rendering the source.