homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Linking to a named anchor inside an iframe
using javascript

10+ Year Member

Msg#: 252 posted 5:48 pm on Jan 3, 2003 (gmt 0)


I've been trying to find a solution for this problem but I can't seem to get it.

Here is the problem:

I have a webpage that has an iframe with the id chat. Inside this iframe another page displays which has an iframe too with the id message_fr.

This last iframe message_fr refreshes itself each 20 seconds, displaying some text. My problem is that each time it refreshes it goes to the top of the document, but I want it to go to the bottom.

So I thought that maybe the solution was to add an "a name". So at the end of the document I added this line:

<a name="end"> &nbsp;&nbsp; </a>

And i created a short javascript in the body that takes the document to that place:


document.location = "#end";


I thought it may work fine, but then I tested and I found out that the whole document moves...when I only want the document in the iframe message_fr to move.

I thought that maybe I should point out to the iframe object and I tried with different sintaxis:

document.chat.message_fr.location = "#end";
document.message_fr.location = "#end";
message_fr.location = "#end";
self.location = "#end";

But none of them work...with the first three I get the error "no object found"... and with the last one I get the same result (the whole document moves)...

I hope that I was able to explain my problem and it would be great if someone could help me out with this...




WebmasterWorld Senior Member korkus2000 us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 252 posted 5:54 pm on Jan 3, 2003 (gmt 0)

Have you tried

document.chat.location = "#end";

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