Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
timer does not work in IE

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP
View previous topic :: View next topic  
Author Message
momukhtar
New one
New one


Joined: 07 Oct 2008
Posts: 1

PostPosted: Tue Oct 07, 2008 2:26 am    Post subject: timer does not work in IE Reply with quote

I have a Ajax / PHP timer code that would run and update timer on a webpage for 2 hrs. But in IE the time does not refresh and maintain its initial value.

Code:


<?php

function timeDiff($startTime) {


   $tNow = date("h:i:s");
   //echo $tNow."<br/>";

   // Extract $current_date h:m:ss
   $current_hour = substr($tNow,0,2);
   $current_min = substr($tNow,3,2);
   $current_seconds = substr($tNow, 6, 2);

   $start_hour = substr($startTime,0,2);
   $start_min = substr($startTime,3,2);
   $start_seconds = substr($startTime, 6, 2);
   
   $tFinishtime = mktime($start_hour+2, $start_min, $start_seconds);
   $tCurrenttime = mktime($current_hour, $current_min, $current_seconds);
   
   $hoursround = floor(($tFinishtime-$tCurrenttime)/3600);
   $minutesround = floor((($tFinishtime-$tCurrenttime)/60) - (60 * $hoursround) );
   $secondsround = ($tFinishtime-$tCurrenttime) - (60 * 60 * $hoursround) - (60 * $minutesround);
   
   $hoursround = "0".$hoursround;
   
   if($secondsround < 10)
      $secondsround = "0".$secondsround;
   if($minutesround < 10)
      $minutesround = "0".$minutesround;
   
   echo  $hoursround. ":". $minutesround. ":".$secondsround;
}

timeDiff($_GET['time']);
?>

function timer() {
//debugger;
   var xmlHttp;
   try {

      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;
         }
       }
   }
   
   xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
         document.onlinetestform.timer1.value = xmlHttp.responseText;

       }
   }
   xmlHttp.open("GET","time.php?time=06:51:00",true);
   xmlHttp.send(null);
   newtime = window.setTimeout("timer();", 1000);
}
Back to top
View user's profile Send private message
vikas1234
Frequent Poster
Frequent Poster


Joined: 24 Aug 2008
Posts: 29

PostPosted: Thu Jun 25, 2009 5:30 pm    Post subject: Reply with quote

Is it working with other browser like firefox or opera ??
_________________
Free Online Books|Free pdf Books |free AJAX Books
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert