我目前正在寻找一种解决方案,允许我以一种紧凑、易于阅读的方式显示大量日志输出。目标是隐藏尽可能多的信息,直到它们变得有趣,因为我们需要显示数千行日志输出。
通过在 td 中引入 div,我已经成功地阻止了我们的表格达到 2800 像素的宽度。现在,一旦用户将鼠标悬停在 div 上,我想向用户公开全部信息,但不会破坏表格的布局,也不需要在代码中两次包含所有信息,因为 html 已经接近 3-4 MByte。
可以使用 Javascript 和/或 JQuery,但我是新手,目前卡住了。
这是 html 代码的一个小简化示例。
<head>
<title>expose full details</title>
<style>
#codeline { width:150px; overflow:hidden; text-overflow: ellipsis; }
#fullline { background: #EEE; z-index: 10; display: hidden; }
#loglines { width:250px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap;}
</style>
</head>
<body>
<table style="border:1px solid black;">
<tr>
<td>PASS</td>
<td>2012-10-10 09:30:31</td>
<td><div id="codeline">c:\myfiles\are\not\stored\here\testscript.py:line434</div></td>
<td><div id="loglines">Here is a very long log output that might continue for 10-20 lines</div></td>
</tr>
<tr>
<td>FAIL</td>
<td>2012-10-10 09:30:32</td>
<td><div id="codeline">c:\myfiles\are\not\stored\here\testscript.py:line439</div></td>
<td><div id="loglines">Here is another very long log output that might continue for 10-20 lines</div></td>
</tr>
</table>
每一个提示都值得赞赏!
谢谢!