I am not sure what your question is asking. When you say enter Button, are
you referring to hitting the enter key? Because I do not see a button in
your code?

On a side note, this is not an Ajax problem but what it appears to be if I
am guessing right is that the call to the server via

var url="index.cfm?fuseaction=Chat.CheckMessages";

May be throwing an error at a guess.

Might I suggest getting firefox, downloading the plugin fireDebug and
switching on HTTPRequests this will at least give you more information on
whether the call to the server is in fact throwing an error. Or you could
just look into the CF logs, but fireDebug is an easier and quicker way of
knowing.

Also by looking at your code, you have no submit button. Which means that to
wrap the <input type="text"> in a form is not necessary either. Unless you
want to submit the entire form, but judging by your code this is not what
you are doing. So the form tags are not needed in this example.



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273



-----Original Message-----
From: Phillip M. Vector [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 12 June 2007 11:30 AM
To: CF-Talk
Subject: Re: OnEnter issues

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>


        
        
        





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280729
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to