实现同一个页面上的两个iframe同步滚动
这是正常的
- HTML code
<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 code
<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> [解决办法]