Simple problem with a simple chat script

Discussion in 'Javascript' started by dillon, Nov 10, 2003.

  1. dillon

    dillon Guest

    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
     
    dillon, Nov 10, 2003
    #1
    1. Advertising

  2. dillon

    higabe Guest

    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:
    >
    > 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, Nov 17, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ali
    Replies:
    0
    Views:
    397
  2. Angus Parvis

    simple RMI chat problem

    Angus Parvis, May 17, 2005, in forum: Java
    Replies:
    1
    Views:
    10,856
    BartCr
    May 17, 2005
  3. Replies:
    0
    Views:
    2,219
  4. Dave Kelly

    simple chat script

    Dave Kelly, Feb 18, 2007, in forum: HTML
    Replies:
    4
    Views:
    1,140
    J.O. Aho
    Feb 19, 2007
  5. Clayton23

    simple chat script

    Clayton23, Jun 12, 2008, in forum: Javascript
    Replies:
    1
    Views:
    169
    Peter
    Jun 12, 2008
Loading...

Share This Page