Results 1 to 8 of 8

Thread: Chatbox

  1. #1

    Thread Starter
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802

    Chatbox

    I've been trying to write a chatbox lately, but I can't make it work the way I want. I havn't found a good way to limit the line-length of the posts. Right now I just insert a <br /> every 20 characters, but it doesn't work very well. Any other ideas?
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Why would you need to have line limits? What is the text being contained in?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    The text will be contained in a div. I need the limit so that even if someone writes a reeealllly long word it won't stretch the div.
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  4. #4
    Junior Member
    Join Date
    Apr 2004
    Location
    Stockholm, Sweden
    Posts
    29
    Set the div to a fixed width?
    Doesn't have to be pixels, can be percentage as well, but as far as I know the DIV will word-wrap automatically if the width has been set.
    If there is a way to solve your problems, there is no need to worry; if there is no way to solve your problems, there is no point to worry.

  5. #5

    Thread Starter
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    Strange as it may sound, but the text will go outside of the div if the div is fixed size and the text won't fit on one line. Check out tobbesweden.1go.dk The post at the top will show you what I mean...
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  6. #6
    Junior Member
    Join Date
    Apr 2004
    Location
    Stockholm, Sweden
    Posts
    29
    In my browser at work (MSIE 6.0, Windows 2000) the DIV actually expands so that the entire line with all the w's on it will fit inside, but I see your point.

    That is extremely odd actually. I assume overflow: auto; is an insatisfactory solution to the problem?
    Maybe you could try and set a width to the element containing the text, since I assume there's a paragraph or another div that contains the actual chatbox entry?
    If there is a way to solve your problems, there is no need to worry; if there is no way to solve your problems, there is no point to worry.

  7. #7

    Thread Starter
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    Hej,

    I use Opera 7.5 (WinXP) and here the text goes out of the div. I will try to have a separate <p></p>for every message and see how that works out.
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  8. #8
    Junior Member
    Join Date
    Feb 2004
    Location
    Stalkers!
    Posts
    24
    well, when i made mine i contained a div inside of a div, like so:
    Code:
    <div style="width: 100px; height: 300px">
    <div style="width: 100px; height: 300px; overflow: auto">
    --- php here ---
    </div></div>
    and it works just fine. sometimes though, if there is a broken link inside the posts it'll mess up like you said. i don't know why.

    EDIT:

    OR you could put the posts into a table inside of a div, with the border set to 0 so its invisible...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width