Jump to content

window.scroll(x,y) for a targeted iframe not working

- - - - -

  • Please log in to reply
No replies to this topic

#1
1988

1988

    Newbie

  • Members
  • Pip
  • 4 posts
So,I have two iframes, one which is designated as "showframe" and represents a huge map:

<iframe src="map.xhtml" width="100%" height="400" name="showframe"> </iframe>

The other one contains list of all locations, which uses JS to center the first iframe on given coordinates on that map:

<a class="locind" href="javascript:window.scroll(630,820);" target ="showframe"> Location A</a>

The point is, it works perfectly in FireFox, however, chrome doesn't seem to be able to detect targeted frame, and centers itself instead. I googled and searched around, and found this:

<script>

function myScroll(id, x, y) {

  document.getElementById(id).contentWindow.scroll(x, y);

}

</script>


<a class="locind" href="javascript:myScroll('showframe', 630,820);" >Hotel Bosna</a>

But this doesn't do anything when I click on the link, and I' not sure why... Anyway, if you can find the problem with the second code, or have a better solution, please, enlighten me :)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users