由于您无法修改该文件,因此唯一的方法是将其包装在<frame>
或中,并驱动从相邻/包含页面中的JavaScript进行搜索和滚动。
下面是一个例子,你可以在http://entrian.com/so-container.html
<html><head><script>
function go() {
// "line" is the <input> for which line to jump to; see the HTML.
var line = document.getElementById('line').value;
if (document.body.createTextRange) { // This is IE
var range = frames['log'].document.body.createTextRange();
if (range.findText(line)) {
range.select(); // Scroll the match into view and highlight it.
}
} else { // Non-IE. Tested in Firefox; YMMV on other browsers.
frames['log'].find(line); // Scroll the match into view and highlight it.
}
}
</script></head><body>
<input type='text' size='5' name='line' id='line' value='10'>
<button onclick='go()'>Go</button><br>
<iframe name='log' width='100' height='50' src='so-data.txt'>
<!-- so-data.txt contains the numbers 01-20 on separate lines -->
</body></html>
网上试试我测试过,在IE7和FF3;如果它没有编辑地在别处工作,我会感到惊讶,但你永远不知道你的运气!
显然在你的情况下,你会以编程方式驱动滚动而不是通过<input>
框,但你可以看到它如何为你工作。
日志文件是一个原始的`.txt`文件吗? – 2009-07-14 21:03:12
这是一个。在chrome/firefox/ie中很好地显示的日志文件(文本不会混淆在一起 – Dirk 2009-07-14 21:09:24
您可以为我们提供一小部分日志文件供下载和查看,也许有工具可以解析它并在表格中显示方式与搜索功能 – balexandre 2009-07-14 21:13:59