Question: to the following code add a 2 minute timer that starts when button 1(place order) is pressed the timer should always be displayed. Button2 (cancle
to the following code add a 2 minute timer that starts when button 1(place order) is pressed the timer should always be displayed. Button2 (cancle order) cancels the timer and resets.
KMOG U.I.
var x = document.getElementById("ui");
function ChangState() {
x.innerHTML = "Your Order has been Placed";
clear();//call function clear()
}
//function confirm1()
function confirm1()
{
//showing alert to the user
var usrResponse=confirm('are you sure you want to cancle the order?');
if(usrResponse==true)
{
//when user response is true then
ChangState2();//call function ChangState2()
}
}
//function ChangState2()
function ChangState2() {
x.innerHTML = "Your Order has been canceled";
clear();//call function clear()
}
//function confirm2()
function confirm2()
{
//showing alert to the user
var usrResponse=confirm('The sterilization is not done. Do you still want to unlock the book?');
if(usrResponse==true)
{
//when user response is true then
ChangState3();//call function ChangState3()
}
}
function ChangState3() {
x.innerHTML = "The UV book is now unlocked";
clear();//call function clear()
}
//function to clear message
function clear()
{
setTimeout( function(){x.innerHTML="";}, 5000);
return false;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
