这是正常的<html>
<head>
<style>
DIV {width:200;height:200;border:solid 1px;overflow-x:hidden;overflow-y:scroll;}
body {margin:0}
</style>
</head>
<body>
<div onscroll="ToScroll.scrollTop = this.scrollTop;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
</td>
</tr>
</table>
</div> <div id="ToScroll" style="left:320px;position:absolute;top:0px;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
</td>
</tr>
</table>
</div>
</body>
</html> 这是错误的. 为什么加入动态的页面就错啊?
<html>
<head>
<style>
DIV {width:800;height:200;border:solid 1px;overflow-x:hidden;overflow-y:scroll;}
body {margin:0}
</style>
</head>
<body>
<div onscroll="ToScroll.scrollTop = this.scrollTop;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"/>
</td>
</tr>
</table>
</div> <div id="ToScroll" style="left:320px;position:absolute;top:0px;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"/>
</td>
</tr>
</table>
</div>
</body>
</html>
<head>
<style>
DIV {width:200;height:200;border:solid 1px;overflow-x:hidden;overflow-y:scroll;}
body {margin:0}
</style>
</head>
<body>
<div onscroll="ToScroll.scrollTop = this.scrollTop;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
</td>
</tr>
</table>
</div> <div id="ToScroll" style="left:320px;position:absolute;top:0px;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
</td>
</tr>
</table>
</div>
</body>
</html> 这是错误的. 为什么加入动态的页面就错啊?
<html>
<head>
<style>
DIV {width:800;height:200;border:solid 1px;overflow-x:hidden;overflow-y:scroll;}
body {margin:0}
</style>
</head>
<body>
<div onscroll="ToScroll.scrollTop = this.scrollTop;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"/>
</td>
</tr>
</table>
</div> <div id="ToScroll" style="left:320px;position:absolute;top:0px;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"/>
</td>
</tr>
</table>
</div>
</body>
</html>
<html>
<head>
<script language="javascript">
function doscroll1()
{
div2.scrollTop=div1.scrollTop;
}
function doscroll2()
{
div1.scrollTop=div2.scrollTop;
}
</script>
</head>
<body>
<div id="div1" onscroll="doscroll1()">
<iframe src="http://www.hao123.com"/>
</DIV>
<div id="div2" onscroll="doscroll2()">
<iframe src="http://www.hao123.com"/>
</DIV>
这句才是关键
1、iframe似乎没有onscroll事件
2、div的事件不能影响到iframe的scroll事件
3、如果有句柄的情况下 #5的那句能够解决问题。。
<html>
<head>
<script language="javascript">
function doscroll1()
{
ifr1.document.body.scrollTop = ifr2.document.body.scrollTop;}
function doscroll2()
{
ifr2.document.body.scrollTop = ifr1.document.body.scrollTop;
}
</script>
</head>
<body>
<div id="div1" onscroll="doscroll1()">
<iframe id="frm1" src="http://www.hao123.com"/>
</DIV>
<div id="div2" onscroll="doscroll2()">
<iframe id="frm2" src="http://www.hao123.com"/>
</DIV>
<body>
<table border="1" cellpadding="0" cellspacing="0" width="300" height="400">
<tr>
<td height="400" width="50"><iframe name="left" src="http://www.hao123.com" width="50" height="100%"></iframe></td>
<td height="400"><iframe name="right" src="http://www.hao123.com" width="100%" height="100%"></iframe></td>
</tr>
</table>
</body>
比如也是通过URL获取的页面信息.
<html>
<head>
<style>
DIV {width:200;height:200;border:solid 1px;overflow-x:hidden;overflow-y:scroll;}
body {margin:0}
</style>
</head>
<body>
<div onscroll="ToScroll.scrollTop = this.scrollTop;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"></iframe>
</td>
</tr>
</table>
</div> <div id="ToScroll" style="left:320px;position:absolute;top:0px;">
<table border="1" width="99%" height="99%">
<tr height="1000">
<td width="99%">
<iframe src="http://www.hao123.com"></iframe>
</td>
</tr>
</table>
</div>
</body>
</html>