Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Linking to a named anchor inside an iframe

using javascript

5:48 pm on Jan 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 7, 2002
votes: 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...


5:54 pm on Jan 3, 2003 (gmt 0)

Senior Member

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

joined:Mar 20, 2002
votes: 0

Have you tried

document.chat.location = "#end";


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members