Hello,

I am working on a webpage that has some frames that contain webpages that are on other servers. Some of the frames are smaller than the webpages that they contain; also, some of these embedded webpages may start out at named anchors (http: //site.com/#anchor_name) which result in the content being scrolled to the right.

I would like to scroll each frame, as soon as that frame first finishes loading, in one of a few ways: all the way to the left, all the way to the right, or leaving the default horizontal position.

At this time, the only browser I need to support is Firefox 5.

As suggested in http://stackoverflow.com/questions/1...omment-6499395 I have produced a main and a subsidiary HTML file.

I think the problem is finding an object syntax that can scroll one frame in my setup. For example:
Code:
blah.scrollBy(-65000, 0)
The "blah" is the part I am looking for. I think that once I have this, writing the code to determine which frame to scroll, and in which direction, will be straightforward.

I can consider a different approach than the one described in the stackoverflow.com article above, but I prefer that it be simple. I do not have access to the embedded webpages to change them.

Simplified versions of my 2 HTML files are as follows. The real "main.html" will eventually have several nested framesets, some with the contents stacked one above the other (rows=) and some with the contents arranged left to right (cols=).

main.html
Code:
<html>
<head>
<script type="text/javascript">
<!--
function fillTheShimFrames()
{
  // This code causes each "shim frame" to load the webpage specified by the 
  // mandatory "data-URL" custom attribute of the <frame> definition.  

  var theFrames = document.getElementsByTagName("frame")
  
  for(var i = 0; i < theFrames.length; i++)
  {
    var aFrame = theFrames[i]
    var targetURL = aFrame.getAttribute("data-URL")
    aFrame.contentDocument.getElementsByTagName("frame")[0].src = targetURL
  }
}
//-->
</script>
</head>

<frameset cols="45%,*" onload="fillTheShimFrames()">

    <frame src="frame_shim.htm" id="0"
      data-URL="http://www.mozillazine.org/"
    >

    <frame src="frame_shim.htm?s=L" id="1"
      data-URL="http://mozilla.com/"
    > 

</frameset>
</html>
frame_shim.htm - after this code listing, there is a note about getSearchParam
Code:
<html>
<head>
<script type="text/javascript">
<!--
function scrollTweak() 
{
  if (document.getElementsByTagName("frame")[0].src != "about:blank")
  {
    scrollDirection = getSearchParam("s")
    switch(scrollDirection)
    {
      case "L":
      // scroll all the way to the left
      break;

      case "R":
      // scroll all the way to the right 
      break;

      default:
    }
  }
}
//-->
</script>
</head>

<frameset>
<frame src="about:blank" onload="scrollTweak()">
</frameset>
</html>
getSearchParam is a helper function to decode the part of the URL after the question mark ("?"). For clarity, I left this function out of the code listing. The function is similar to the one at http://stackoverflow.com/questions/5...#answer-523293 or you can hard-code "L" in place of getSearchParam("s") if you want to test the above HTML.

It is fine if the call to scrollBy() is in "main.htm" instead of "frame_shim.htm." I have tried putting it in both files, and in both cases I haven't found an object reference syntax that works.

Thanks in advance for suggestions.