Help me in completing this project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvamohan
    New Member
    • May 2007
    • 4

    Help me in completing this project

    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

    [code=javascript]function start()
    {

    i++;
    timer = setTimeout("sta rt()",1000);

    if(i==11)
    {
    // Updating the Radio Button value
    var sessionid = window.top.loca tion.search.sub string(0)
    var ind = sessionid.index Of("&")
    if(ind==-1)
    ind=sessionid.l ength
    var mod = sessionid.subst r(0,ind)
    var xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
    xmlhttp.onready statechange=fun ction()
    {
    if (xmlhttp.readyS tate==4)
    {
    //alert(xmlhttp.r esponseText)
    }

    }
    var url = rev(window.top. location.toStri ng());
    var ind = url.indexOf("/");
    url= url.substr(ind+ 1);
    url= rev(url)+"/time.aspx";
    var timeelapsed=hh+ ":"+mm+":"+ ss;
    var timeleft=hhLeft +":"+mmLeft+":" + ssLeft;
    url =url+"?timeleft ="+timeleft+"&t imeelapsed="+ti meelapsed ;
    xmlhttp.open("G ET",url,true) ;
    xmlhttp.send(nu ll);
    //document.forms( "Form1").submit ()
    // LoadTime()
    i=0;
    }
    ss = parseInt(ss) + 1;
    if(parseInt(ss) >59)
    {
    ss = "00";
    mm=parseInt(mm) + 1;
    }
    if(parseInt(mm) >59)
    {
    mm ="00";
    hh =parseInt(hh) + 1;
    }
    ssLeft = parseInt(ssLeft ) - 1;
    if(parseInt(ssL eft)<0)
    {
    if(parseInt(mmL eft)>0)
    {
    ssLeft = 59;
    mmLeft=parseInt (mmLeft) -1
    }
    }
    if(parseInt(mmL eft)<=0 && parseInt(ssLeft )<=0)
    {
    if(parseInt(hhL eft)>0 )
    {
    mmLeft = 60;
    hhLeft=eval(hhL eft) - 1
    }
    }


    // Updating The Status
    curtm.innerText = hh + " : "+ mm + " : "+ss;
    remtm.innerText = hhLeft +" : "+ mmLeft + " : "+ssLeft;
    document.all("H H").value=hh
    document.all("M M").value=mm
    document.all("S S").value=ss
    document.all("H HLeft").value=h hLeft
    document.all("M MLeft").value=m mLeft
    document.all("S SLeft").value=s sLeft
    if((parseInt(hh Left)<=0) && (parseInt(mmLef t)<=0) && (parseInt(ssLef t)<=0) || (parseInt(hh)<0 ) && (parseInt(mm)<0 ) && (parseInt(ssLef t)<0))
    {
    clearTimeout(ti mer)
    alert("finish") ;
    // document.forms( "form1").action ="main.aspx?key =close"
    // document.forms( "form1").submit ()
    // document.forms( "Form1").action ="Default.aspx? key=close"
    // document.forms( "Form1").submit ()
    }
    }
    [/code]



    but it is not working the code in time.aspx does'nt excetues please any one help me .
    Last edited by acoder; Sep 20 '08, 03:52 PM. Reason: changed bold to code tags
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

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

    Comment

    Working...