呵呵,真巧,刚好前段时间做过类似的东西了,我写个简单的例子给你看看,应该就是你想要的效果。<Script language="JavaScript">
function init(){
moveLeft()
moveScroll()
}
function moveScroll() {
document.all.Header.style.posTop = document.body.scrollTop;
setTimeout('moveScroll()',10);
}
function moveLeft(){
for(i=0;i<document.all.Left.length;i++){
document.all.Left(i).style.posLeft = document.body.scrollLeft;
}
setTimeout('moveLeft()',10);
}
</Script><html>
<body onload="init()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table x:str border=1 cellpadding=0 cellspacing=0 width=1500>
<tr id="Header" style="position:relative;z-index:100" height=19 bgcolor="#e1e2e3">
<td height=19 align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
</tr>
<tr height=19 style='height:14.25pt'>
<td id="Left" style=position:relative bgcolor="#e1e2e3" height=19 align=center>AAA</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
</tr>
<tr height=19 style='height:14.25pt'>
<td id="Left" style=position:relative bgcolor="#e1e2e3" height=19 align=center>AAA</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
</tr>
</table>
</body>
</html>
function init(){
moveLeft()
moveScroll()
}
function moveScroll() {
document.all.Header.style.posTop = document.body.scrollTop;
setTimeout('moveScroll()',10);
}
function moveLeft(){
for(i=0;i<document.all.Left.length;i++){
document.all.Left(i).style.posLeft = document.body.scrollLeft;
}
setTimeout('moveLeft()',10);
}
</Script><html>
<body onload="init()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table x:str border=1 cellpadding=0 cellspacing=0 width=1500>
<tr id="Header" style="position:relative;z-index:100" height=19 bgcolor="#e1e2e3">
<td height=19 align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
<td align=center>test</td>
</tr>
<tr height=19 style='height:14.25pt'>
<td id="Left" style=position:relative bgcolor="#e1e2e3" height=19 align=center>AAA</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
<td align=center>111</td>
</tr>
<tr height=19 style='height:14.25pt'>
<td id="Left" style=position:relative bgcolor="#e1e2e3" height=19 align=center>AAA</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
<td align=center>222</td>
</tr>
</table>
</body>
</html>
http://www.51windows.net/myjs/?u=/hw/asp/jsview.asp?id=314