need a code that opens up a website in an iframe, and scrolls down to it

Status
Not open for further replies.

ibexpiotr

In Runtime
Messages
243
Location
New York
ok. so i have this one page with a bunch of links on top, and an iframe, on the bottom of the page.
once i click on the link i want the page to be displayed in the iframe, and the page to be automaticly scrolled down to where the iframe starts.
 
Hmm, how about...a simple link:
Code:
<a href="your link" target="your iframe" onclick="focusIframe();">Hello</a>
Then some JS (put this in the <head> or <body> area):
Code:
<script type="text/javascript">
  function focusIframe( ) {
    var theElement = document.getElementById( "your iframe id" );
    
    if ( document.all ) {
      // Internet Explorer
      theElement.document.body.focus( );
    } else {
      // Firefox
      theElement.contentDocument.body.focus( );
    }
  }
</script>
...with some credit due to the FF/IE differences here.

Just remember to set the id="your iframe id" attribute.

That might work, though it's pure speculation...;)
 
thx. it works when i open it in firefox, but when i try in ie, a window pops up, saying something like, for security reasons, the content has been blocked.. and when i click the link, it opens up in a new window..

with firefox it works great,
 
Interesting...always gotta leave it to IE to create trouble! I would think it'd be the javascript if anything, but since it opens in a new window, it's saying the target="" is bad?! That sounds very odd, hmm, maybe someone else will know how to get around that...

I'll try to play with it when I get home. :eek:
 
If you opening the file on your pc and it is not on a webserver it will ask to run ActiveX Control , this will dissapear when it is ran on a server ?

Am i right i guessing that this is the problem?
 
Status
Not open for further replies.
Back
Top Bottom