[thelist] Chatbox using ASP?

Warden, Matt mwarden at odyssey-design.com
Fri Jun 22 16:39:27 CDT 2001


> From: "Eveline Vanhemel" <eveline_vanhemel at pi.be>
> Subject: [thelist] Chatbox using ASP?
>
...
> I am trying to make a chatbox for a site I am working on. I know most of
the
> online chatboxes are java applets. Because I am not into Java programming,
I
> promised my client to try to come up with something else, when they asked
me
> if it would be possible, I had some vague idea how I could pull this off
in
> ASP.
...

I haven't actually done this, but it seems like you could have a hidden
frame that acts as a proxy and refreshes to get the new chat text. The main
frame would be a textarea and you'd do something like this (watch wrap):

var numberOfLines = 0;

function updateChatText()
{
    var currentChatText = document.chatform.chattextarea.value;
    if (numberOfLines < 20) {
        document.chatform.chattextarea.value =
parent.frames[0].getNewChatText() + "\n" + currentChatText;
    }
    else
    {
        // somehow wipe out the last line in currentChatText
        // and then do the same thing:
        document.chatform.chattextarea.value =
parent.frames[0].getNewChatText() + "\n" + currentChatText;
    }

    numberOfLines++;

    return;
}

The hidden frame would have something like this:


<html>
<head>
...
<script language="JavaScript" type="text/javascript">
function initiateUpdate()
{
    parent.frames[1].updateChatText();
    return;
}

function getNewChatText()
{
    // make sure the vbcrlf's are converted to "\n", etc.
    return '<%Response.Write variableWithNewChatText%>';
}
...

<script>
</head>
<body onLoad="initiateUpdate();">
foo
</body>
</html>

Get the idea? Like I said, I've never actually tried this.


HTH,


--
mattwarden
mattwarden.com





More information about the thelist mailing list