Simple problem with a simple chat script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dillon

    #1

    Simple problem with a simple chat script

    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 :-)

    This has got a lot longer than I expected, I'd better go to bed now,

    Cheers in advance to anyone who can help :-)

    dillon


  • higabe

    #2
    Re: Simple problem with a simple chat script

    I don't really have any exprience at this but since nobody else has
    answered. Why don't you try:

    window.scroll(0 ,99999999);

    I don't know if it's cross-browser compatible or what but it's a start.

    dillon wrote:[color=blue]
    >
    > 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 :-)
    >
    > This has got a lot longer than I expected, I'd better go to bed now,
    >
    > Cheers in advance to anyone who can help :-)
    >
    > dillon[/color]

    Comment

    Working...