Connecting Tech Pros Worldwide Forums | Help | Site Map

Help me in completing this project

Newbie
 
Join Date: May 2007
Location: Bangalore
Posts: 4
#1: Sep 19 '08
Hai every one i am developing a online exam for submitting to my university,
i am using Dotnet 2005 with framework 2.0 and backend as mysql 5.0
i want to update the time to database frequently with out disturbing the user and knowing to user so that once he closes the window and again logins answers he clicks has to be retrieved and time maintainence so please help in this case i have used following code to perform that in an another page

Expand|Select|Wrap|Line Numbers
  1. function start()
  2.            {
  3.  
  4.                   i++;
  5.                   timer = setTimeout("start()",1000);
  6.  
  7.                         if(i==11)
  8.              {
  9.                  // Updating the Radio Button value
  10.                  var sessionid = window.top.location.search.substring(0)
  11.                  var ind = sessionid.indexOf("&")
  12.                  if(ind==-1)
  13.                      ind=sessionid.length
  14.                      var mod = sessionid.substr(0,ind) 
  15.                      var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  16.                      xmlhttp.onreadystatechange=function() 
  17.                      {
  18.                           if (xmlhttp.readyState==4)
  19.                           {
  20.                                   //alert(xmlhttp.responseText)
  21.                           }
  22.  
  23.                      }
  24.                      var url = rev(window.top.location.toString());  
  25.                      var ind = url.indexOf("/");
  26.                      url= url.substr(ind+1);
  27.                      url= rev(url)+"/time.aspx";
  28.                      var timeelapsed=hh+ ":"+mm+":"+ ss;
  29.                      var timeleft=hhLeft+":"+mmLeft+":"+ ssLeft;   
  30.                      url =url+"?timeleft="+timeleft+"&timeelapsed="+timeelapsed ;
  31.                      xmlhttp.open("GET",url,true);
  32.                      xmlhttp.send(null);    
  33.                              //document.forms("Form1").submit()
  34.                              // LoadTime()
  35.                              i=0;
  36.                   }     
  37.                   ss = parseInt(ss) + 1;
  38.                   if(parseInt(ss)>59)
  39.                   {
  40.                          ss = "00";
  41.                          mm=parseInt(mm) + 1;
  42.                   }
  43.                   if(parseInt(mm)>59)
  44.                   {
  45.                          mm ="00";
  46.                          hh =parseInt(hh) + 1;
  47.                   }
  48.                   ssLeft = parseInt(ssLeft) - 1;
  49.                   if(parseInt(ssLeft)<0)
  50.                   {  
  51.                        if(parseInt(mmLeft)>0)
  52.                        {
  53.                             ssLeft = 59;
  54.                             mmLeft=parseInt(mmLeft) -1
  55.                        }
  56.                   }
  57.                   if(parseInt(mmLeft)<=0 && parseInt(ssLeft)<=0)
  58.                   {
  59.                        if(parseInt(hhLeft)>0 )
  60.                        {
  61.                                mmLeft =  60;
  62.                                hhLeft=eval(hhLeft) - 1
  63.                        }
  64.                   } 
  65.  
  66.  
  67.                   // Updating The Status        
  68.                   curtm.innerText = hh + " : "+ mm + " : "+ss;
  69.                   remtm.innerText = hhLeft +" : "+ mmLeft + " : "+ssLeft;
  70.                   document.all("HH").value=hh
  71.                   document.all("MM").value=mm
  72.                   document.all("SS").value=ss
  73.                   document.all("HHLeft").value=hhLeft
  74.                   document.all("MMLeft").value=mmLeft
  75.                   document.all("SSLeft").value=ssLeft
  76.                    if((parseInt(hhLeft)<=0) && (parseInt(mmLeft)<=0) && (parseInt(ssLeft)<=0) || (parseInt(hh)<0) && (parseInt(mm)<0) && (parseInt(ssLeft)<0)) 
  77.                   {
  78.                        clearTimeout(timer)
  79.                        alert("finish");
  80. //                       document.forms("form1").action="main.aspx?key=close"
  81. //                       document.forms("form1").submit() 
  82. //                       document.forms("Form1").action="Default.aspx?key=close"
  83. //                       document.forms("Form1").submit() 
  84.                   } 
  85.              }
  86.  


but it is not working the code in time.aspx does'nt excetues please any one help me .

iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#2: Sep 26 '08

re: Help me in completing this project


I would first note to try to send "" instead of null this has caused issues before.
Reply