shavenlunatic
MIS
Hi,
I hope someone can help me out here.
I somehow managed to muddle my way through (with no prior knowledge) to making a shoutbox on a website using AJAX to avoid doing full screen refreshes.
The shoutbox (inside a div) works fine if the user "Clicks" the submit button... the data is sent, the chat-screen updates with no refresh.. but if return is pressed the whole screen refreshes and the message is not posted. It's very likely something very noobish and I'm surprised I managed to get this far to be honest.
Here is the form, all I want is the return key to do exactly the same thing as clicking submit does (runs lobbyshout().
and the lobbyshout javascript, if it's of any use
Thanks in advance for any advice
________
clueless
I hope someone can help me out here.
I somehow managed to muddle my way through (with no prior knowledge) to making a shoutbox on a website using AJAX to avoid doing full screen refreshes.
The shoutbox (inside a div) works fine if the user "Clicks" the submit button... the data is sent, the chat-screen updates with no refresh.. but if return is pressed the whole screen refreshes and the message is not posted. It's very likely something very noobish and I'm surprised I managed to get this far to be honest.
Here is the form, all I want is the return key to do exactly the same thing as clicking submit does (runs lobbyshout().
Code:
<form name="lobby" method="get">
<input name="postshout" type="text" class="Style7" value="" size="35" maxlength="100" />
<input type="button" name="btnsubmit" value="Send" onclick="LobbyShout(this.form)" />
</form>
and the lobbyshout javascript, if it's of any use
Code:
function LobbyShout ()
{
var ShoutText = document.lobby.postshout.value
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="PostShout.php"
url=url+"?ShoutText="+ShoutText
var myDate = new Date();
var rand = myDate.getTime();
url=url+"&rand="+rand
xmlHttp.readystate
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
document.lobby.postshout.value = ""
}
Thanks in advance for any advice
________
clueless