homepage Welcome to WebmasterWorld Guest from 54.197.183.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Iframe Scrollto(x,y)
Iframe Scrollto
janton

5+ Year Member



 
Msg#: 3813111 posted 1:57 am on Dec 23, 2008 (gmt 0)

Hello,

I'm googling and googling and can't get it working! :(

I have a iframe frome a external website.
This iframe I want to begin at 200 px on x and 20 px on y..

So i thought, this can be done.. well it should be but i tried different java codes.. But so far no luck!

So i found i have to use window.scrollTo(200,20)
or
document.frames['IFRAME_ID_HERE'].scrollTo(x, y);

All my code is mest up now :( so can't show what i have now makes no sense anymore..

Is it possible?
I will post my code when i cleaned it up!

 

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3813111 posted 3:41 pm on Dec 23, 2008 (gmt 0)

Why can't you just use page anchors and dispense with the Javascript? If the source code has any anchors or even ID'ed elements, this should work.


<ul>
<li><a href="iframe.html#help">Help</a></li>
<li><a href="iframe.html#contact">Contact</a></li>
<li><a href="iframe.html#about">About</a></li>
</ul>
<iframe src="iframe.html"></iframe>

In iframe.html:


<a name="help" id="help"></a>
<h3>Help</h3>
<p>Paragraphs or lists on help . . . </p>
<a name="contact" id="contact"></a>
<h3>Contact</h3>
<p>Paragraphs or lists on contact info . . . </p>
<a name="about" id="about"></a>
<h3>About</h3>
<p>Paragraphs or lists on about topic . . . </p>

It doesn't require anchors. If it's coded with ID elements,

<h3 id="help-head">Help</h3>

You should still be able to do

<li><a href="iframe.html#help-head">Help</a></li>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved