0

I want to show a confirmation dialogue for only a specific time, so that it runs out when the user

a) leaves the page

b) doesn't answer in a specific time

var acception = confirm("Accept?");

if(acception == true){
    changeStatus("accepted");
}
else{
    changeStatus("denied");
}
Milan Chheda
  • 8,159
  • 3
  • 20
  • 35

1 Answers1

0

you can not close the javascript alert and confirm boxes by the script.You can use jquery dialog boxes instead of confirm box. Jquery:

  <script>
  $( function() {
    $( "#dialog" ).dialog();
    //To close you can use settimeout
    window.setTimeout(
    function() { 
    $('#dialog').dialog('close'); 
    }, 10000);
  });
  </script>

If you want confirm message with return true or false means you can refer here.

lalithkumar
  • 3,480
  • 4
  • 24
  • 40