Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
JavaScript
<script type="text/javascript" language ="javascript" >
        var tim;

        var min = 1;
        var sec = 60;
        var f = new Date();
        function f1() {
            f2();
            document.getElementById("starttime").innerHTML = "Your started your Exam at " + f.getHours() + ":" + f.getMinutes();

            document.getElementById("endtime").innerHTML = "Your  time is :" + f.toLocaleTimeString();
        }
        function f2() {
            if (parseInt(sec) > 0) {
                sec = parseInt(sec) - 1;
                document.getElementById("showtime").innerHTML = "Your Left Time  is :" + min + " Minutes ," + sec + " Seconds";
                tim = setTimeout("f2()", 1000);
            }
            else {
                if (parseInt(sec) == 0) {
                    min = parseInt(min) - 1;
                    if (parseInt(min) == 0) {
                        clearTimeout(tim);

                        document.getElementById('mybutton').click();
                        alert("calling");
                    }
                    else {
                        sec = 60;
                        document.getElementById("showtime").innerHTML = "Your Left Time  is :" + min + " Minutes ," + sec + " Seconds";
                        tim = setTimeout("f2()", 1000);
                    }
                }

            }
        }
    </script>

my whole code is in update panel.
and this is a modal popup window

this is my javascript code....mybtn is the button its inside panel. I want to call its click event or any public void function when timer stops.
Posted

1 solution

Hello Betu,

Please refer to __doPostBack function[^] article available on this site.

Regards,
 
Share this answer
 
Comments
betu.009 24-Oct-13 7:14am    
i tried sir but its not working
Prasad Khandekar 24-Oct-13 8:15am    
Can you update your question to include the aspx code as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900