AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Javascript/iframe control problem

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.javascript
View previous topic :: View next topic  
Author Message
dillon
Guest





PostPosted: Mon Nov 10, 2003 3:09 pm    Post subject: Javascript/iframe control problem Reply with quote



Hi everyone

I'm writing a javascript/php chat script, but I've run into a problem
that is probably very, very simple to fix but I don't have a clue.

The problem is with an iframe (should I be using an iframe in the first
place?) that shows all the chat so far - all I want to do is get the view to
scroll to the bottom of that iframe when it first loads or refreshes.
That's the entire problem in a nutshell! Lines of text are added to the
bottom of the file shown in the iframe, but when the number of lines exceeds
the height of the iframe the vertical scrollbar appears (which is desirable)
but the new conversation is hidden off the bottom.

The reason for the iframe btw is that I couldn't find a compatible way
of updating part of a page without using form elements, and I want to use
things like different font colours for different users in the chat pane,
which I can't with form elements.

Any tips or a possible fix for this would be greatly appreciated, and
particularly cross-browser working example code :-)

Cheers in advance to anyone who can help :-)

dillon



Back to top
Chris Riesbeck
Guest





PostPosted: Mon Nov 10, 2003 6:31 pm    Post subject: Re: Javascript/iframe control problem Reply with quote



"dillon" <dillon (AT) thisaddressisfakeimsorryreallyiam (DOT) com> wrote

Quote:
Hi everyone

I'm writing a javascript/php chat script, but I've run into a problem
that is probably very, very simple to fix but I don't have a clue.

The problem is with an iframe (should I be using an iframe in the first
place?) that shows all the chat so far - all I want to do is get the view to
scroll to the bottom of that iframe when it first loads or refreshes.
That's the entire problem in a nutshell!

An iframe is just a window, so check out the window scrolling methods at

http://www.devguru.com/Technologies/ecmascript/quickref/window.html

Back to top
dillon
Guest





PostPosted: Mon Nov 10, 2003 10:46 pm    Post subject: Re: Javascript/iframe control problem Reply with quote



"Chris Riesbeck" <riesbeck (AT) cs (DOT) northwestern.edu> wrote

Quote:

An iframe is just a window, so check out the window scrolling methods at

http://www.devguru.com/Technologies/ecmascript/quickref/window.html

Hi Chris

Thanks for the info, that's a useful page! I'm still having big
problems though - I've tried using both

window.scrollBy(horizPixels, vertPixels)

and

window.scrollTo(xPosition, yPosition)

with different values for the the second parameter - but for some reason
it won't scroll down beyond about 15 pixels. Whether I try a value of 10 or
300, it does *exactly* the same. Negative values do nothing (as expected,
because I want to scroll downwards). Very odd!

The entire iframe source is simply:

<head>
<script language="JavaScript">
function scrollToBottom() {
window.scrollTo(0, 50);
}
</script>
</head>
<body onLoad="javascript:scrollToBottom();">
Test text

1

2

3

4

5

6

7

8

9

10

</body>

But no matter what I do, it still only scrolls by about 15 pixels. Any
ideas? :-)

Thanks again,

dillon



Back to top
dillon
Guest





PostPosted: Mon Nov 10, 2003 10:54 pm    Post subject: Re: Javascript/iframe control problem Reply with quote

"dillon" <dillon (AT) thisaddressisfakeimsorryreallyiam (DOT) com> wrote

Quote:
I'm still having big
problems

Problem fixed!

For everyone's reference, it was fixed by enclosing the page data in a
div element, and setting style="position:absolute;"

Seeya,

dillon



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.javascript All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.