如何从另一个 IFrame 移动 IFrame 滚动条

How to move IFrame scrollbars from another IFrame

提问人:Pino 提问时间:11/16/2023 更新时间:11/16/2023 访问量:13

问:

我最近遇到了一个问题,我有一个索引页面,其中有 3 个 IFrames。

第1次IFrame:查看照片(照片名称)

第 2 个 IFrame:所有链接的简单列表(列表名称)

第 3 届 IFrame : 查看一张大照片 (pag name)

-Index.htm


<table border="0" align="center" height=100% width="100%" height=150  >
  <tr>
   <td valign="top" width=300 align=center bgcolor=#aaaaaa> 
    <iframe frameBorder="1" width=300 height=300 id="photo" name="photo" src=""></iframe>
    <iframe frameBorder="0" width=300 name="list" height=300 src="list.htm"></iframe> <p>
  </td>
  <td valign="top" colspan="2">
    <iframe frameBorder="0" id="pag" name="pag" src="pag.htm" width=100% height=100%>
    </iframe>
  </td>
 </tr>
</table>

-List.htm

<script type="text/javascript">

function movePic() {

//  works but only on current window 
//  window.scrollTo(0,170);
// not even that works
// window.parent.document.getElementById("pag").focus();
      }

</script>

<body topmargin=0 bgcolor="#ffffff" link="#0000FF" text="#000000" alink="#FF0000" vlink="#FF00FF">
<a href="pic/aa27.jpg" target="photo" onclick="movePic()">Requested Point</a> 

-Pag.htm

一张大照片,需要在整个滚动条中移动到某个点。

我尝试了很多方法,但我无法从第 2 个 IFrame(列表名称)将其焦点传递给第 3 个 IFrame(地图名称)

JavaScript HTML iframe

评论

0赞 IT goldman 11/16/2023
这回答了你的问题吗?将焦点设置为 iframe 内容
0赞 Community 11/16/2023
请澄清您的具体问题或提供其他详细信息以准确说明您的需求。正如目前所写的那样,很难确切地说出你在问什么。
0赞 Pino 11/16/2023
@IT高盛,没有JQuery也是有可能做到这一点的。

答: 暂无答案