[thelist] Prototype/AJAX Neubie question
Anthony Baratta
anthony at baratta.com
Sun Jul 15 21:34:48 CDT 2007
Another way do to what you want is to us Javascript "pseudo-objects".
=-=-=-==-=-=-==-=-=-==-=-=-==-=-=-=
function ShowMessages()
{
this.xmlHttp;
function Run()
{
this.xmlHttp=GetXmlHttpObject();
this.url="CheckMessages.cfm";
this.url=url+"&room="+document.getElementById("Room").value;
this.xmlHttp.onreadystatechange=stateChanged;
this.xmlHttp.open("GET",url,true);
this.xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("Messages").innerHTML=xmlHttp.responseText;
}
}
}
var objShowMsgs = new ShowMessages();
function checkusers()
{
this.xmlHttp;
function Run()
{
this.xmlHttp=GetXmlHttpObject()
this.url="CheckUsers.cfm";
this.xmlHttp.onreadystatechange=this.UsersChanged;
this.xmlHttp.open("GET",url,true);
this.xmlHttp.send(null);
}
function UsersChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("Users").innerHTML=xmlHttp.responseText;
}
}
}
var objUsersChanged = new UsersChanged();
=-=-=-==-=-=-==-=-=-==-=-=-==-=-=-=
Then just call objShowMsgs.Run(); or objUsersChanged.Run();
More information about the thelist
mailing list