Link to home
Start Free TrialLog in
Avatar of suresh pondicherry
suresh pondicherryFlag for United States of America

asked on

javascript setinterval function

Hi,
Advance thanks for the efforts.
I am using setinterval in the javascript. The confirmation box appears exactly after 10 seconds (which is good) . But if i wait for 20 seconds, i could see one confirmation box and it doesn't matter which button (Ok or cancel) i click, i see other dialog immediately (instead of waiting another 10 seconds, the box appears immediately)

window.onload = function () {
                    setInterval(function () {
                    var r = confirm("Click OK to continue your session. Click Cancel to log out.");
                    if (r == true) {                       
                    }
                    else {                      
                        window.location.href = '@Url.Content("~/")';
                    }
                }, 10000);
            };

Open in new window


Also is there any way change button text 'Cancel' to 'Home'

Kind regards,
Pooja
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of suresh pondicherry

ASKER

Hi LVL 83,
It is working. How to change "Cancel" text.

Kind regards,
Pooja
How to change "Cancel" text.
No way
Thanks  leakim971!