PDA

View Full Version : Making spaces stay (kinda hard to word it)


flare1028us
10-05-2004, 02:53 AM
First off, I would like to thank the people who have taken time to help
me on this site. You guys are great!

Next: My problem

I am writing a perl chat server and am using javascript to refresh the chat
page. The chat page refreshes with the onkeyup event.

The perl script takes the current value of the textbox (where the user types
thier text to send) and after refreshing, writes it to the box on the refreshed
page.
(So that the user's message won't disappear when the page refreshes)

However, spaces disappear in the textbox after refreshing.
Here is the javascript code for the refresh function:

<script language="javascript">
document.f.msg.focus();
function rfrsh()
{
setTimeout("window.location='chat.cgi?com=view&msg='+document.f.msg.value", 0);
}
</script>


Why are the spaces disappearing and how can I fix it?

To see the page with the problem, go to
http://flare-designs.cjb.net/t/chat/chat.cgi?com=login&un=CF%20User

If I did not explain my problem where it could be fully understood,
or if you need to see the perl code, please tell me.

Help is always apreciated.
Carlton

hemebond
10-05-2004, 03:05 AM
http://www.w3.org/TR/CSS21/text.html#propdef-white-space

glenngv
10-05-2004, 03:23 AM
If you're referring to the spaces in the messages above the textbox, then just enclose the messages in the <pre> </pre> tags. No need to put <br> at the end of each message, just insert a newline.

<pre>
Flare: Welcome to my chat server.
Flare: If you are from CF and wondering why spaces work now,
Flare: I am typing this in notepad directly into the file containing the
Flare: chat room contents. Visual layout won't be a matter until I can fix the
Flare: space problem. Please reply to my thread if you can help me.:
</pre>