2010-02-22 83 views
0

我的网站隶属于另一个网站iframe。如何从iframe中滚动跨越iframe之外的跨度

托管的网站获得了与滚动范围内的修复高度的iframe(不要问为什么)。

我正在寻找一种方法来改变从iframe(我的网站是)内的跨度滚动(与JS)。

我知道这是可以做到,因为我使用jQueryUI的对话框,位置:顶部(在iframe中)

其滚动范围的顶部(在iframe外)

HTML:

<body style="overflow:hidden;"> 
      <span style="float: left; height:488px; overflow-y:auto;"> 
       <table> 
        <tr> 
         <td> 
           <iframe id="Iframe" name="Iframe" src="Login.aspx" 
           width="775px" height="4000px"></iframe> 
         </td> 
         <td style="width: 200px; height: 600px; font-size: 25px; border: 1px solid #000000;" valign="top">Side Bar</td> 
        </tr> 
       </table> 

      </span> 

回答

1
window.parent.$("span").whateverYouWantToDo(); 

作品只有在iframe中的内容是在同一个域中马在窗口中。

当存在不同的域时只能从主窗口捕获加载事件。试着对此做出反应。 ,看看你可以

document.location.hash做

它可能是从主窗口访问,但它不是跨浏览器