首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

实现同一个页面下的两个iframe同步滚动

2012-09-15 
实现同一个页面上的两个iframe同步滚动这是正常的HTML codehtml head style DIV {width:200height:

实现同一个页面上的两个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> 


[解决办法]
探讨

就比如是 网络里获取过来的.

src="http://www.hao123.com"

热点排行