I think it'd be much easier without the *cough* "AJAX Framework"

In this code... the function 'handleStateChange' is where you read the
response and use the info to change the innerHTML of your image container to
show new text/images/whatever



<script type="text/javascript">

var secs
var timerID = null
var timerRunning = false
var delay = 1000 //1000 ms is 1 second
var xmlHttp;

function createXMLHttpRequest()
{
        if (window.ActiveXObject)
        {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else if (window.XMLHttpRequest)
        {
                xmlHttp = new XMLHttpRequest();
        }
}

function startRequest(url)
{
        createXMLHttpRequest();
        xmlHttp.onreadystatechange = handleStateChange;
        xmlHttp.open('GET', url, true);
        xmlHttp.send(null);
}

function handleStateChange()
{
        if(xmlHttp.readyState == 4)
        {
                if(xmlHttp.status == 200)
                {
                        //Code to change the image and text goes here
                        


                        //Restart the timer again
                        InitializeTimer();
                }
        }
}

function InitializeTimer()
{
    secs = 9
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        startRequest('url_to_new_info.cfm?nocache=' + new Date())
    }
    else
    {
                self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}

window.onload = InitializeTimer;

</script>










 
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 
 

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 5:15 PM
To: CF-Talk
Subject: RE: CFAjax question: [Object Error] in IE, works fine in FF

Anyone have any ideas on this question?

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Friday, December 16, 2005 11:58 AM
To: CF-Talk
Subject: CFAjax question: [Object Error] in IE, works fine in FF


I was wondering if anyone could take a look at this thread in the CFAJAX
group and see if they have any ideas?

http://groups.yahoo.com/group/cfajax/message/890

TIA



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227204
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to