2010-02-22 85 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做

它可能是從主窗口訪問,但它不是跨瀏覽器