Ok.. Last one today. I promise. :) This is just annoying as anything.
Can someone please tell me why when I click the enter button,
entermessage doesn't trigger? It just doesn't call it at all.
Again, thanks for the help so far. Sorry to be such a neubie at AJAX.
==========================================
<body bgcolor="#000000" text="#FFFFFF" link="#FF0000" vlink="#800000"
alink="#C0C0C0">
<script>
var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
return xmlHttp;
}
</script><script>
function showmessages()
{
xmlHttp=GetXmlHttpObject()
var url="index.cfm?fuseaction=Chat.CheckMessages";
url=url+"&room="+document.getElementById("Room").value;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("Messages").innerHTML=xmlHttp.responseText;
}
}
</script>
<script>
function entermessage()
{
xmlHttp=GetXmlHttpObject()
var url="index.cfm?fuseaction=Chat.EnterMessage";
url=url+"&room="+document.getElementById("Room").value;
url=url+"&text="+document.getElementById("Message").value;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
document.getElementById("Message").value='';
return false;
}
</script>
<body onload="showmessages()">
<form onsubmit="return false">
Message:
<input type="text" id="Message" onkeydown="showmessages()"
onenter="entermessage()" size="40">
<input type="Hidden" id="Room" value="1">
</form>
<HR><span id="Messages"></span></body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280728
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4