How to replace javascript message pop-up to Jquery message pop-up with only ok button option

user4884336

I have 2 buttons on the pop-up window (Ok and Cancel) using javascript message pop-up window in below code. But i need only one button option (ok) using jquery or javascript message pop-up because i am not getting concept to disable cancel button using javascript.

Jquery message pop-up should work perfectly according to my below code.

I am working on time out session notification for a masterpage in ASP.NET and below is my javascript pop-up message code:

var active = confirm('Your session will expire in ' + (sess_expirationMinutes - sess_warningMinutes) +
        ' minutes (as of ' + now.toTimeString() + '), press OK to remain logged in ' +
                    'or press Cancel to log off. \nIf you are logged off any changes will be lost.');

Javascript code:

<script type="text/javascript">

var sess_pollInterval = 60000;
var sess_expirationMinutes = 3;
var sess_warningMinutes = 1;
var sess_intervalID;
var sess_lastActivity;

function initSession()
{    
    sess_lastActivity = new Date();
    sessSetInterval();

    $(document).bind('keypress.session', function (ed, e) {


        sessKeyPressed(ed, e);
    });
}

function sessSetInterval() 
{
    sess_intervalID = setInterval('sessInterval()', sess_pollInterval);
}

function sessClearInterval() 
{
    clearInterval(sess_intervalID);
}

function sessKeyPressed(ed, e) 
{
    sess_lastActivity = new Date();
}

function sessLogOut() 
{
    window.location.href = 'Logout.aspx';
}

function sessInterval()
{
    var now = new Date();
    //get milliseconds of differneces 
    var diff = now - sess_lastActivity;
    //get minutes between differences
    var diffMins = (diff / 1000 / 60);

    if (diffMins >= sess_warningMinutes)
    {
        //wran before expiring
        //stop the timer
        sessClearInterval();
        //promt for attention
   var active = confirm('Your session will expire in ' + (sess_expirationMinutes - sess_warningMinutes) +
            ' minutes (as of ' + now.toTimeString() + '), press OK to remain logged in ' +
                        'or press Cancel to log off. \nIf you are logged off any changes will be lost.');

        if (active == true)
        {
            now = new Date();
            diff = now - sess_lastActivity;
            diffMins = (diff / 1000 / 60);

            if (diffMins > sess_expirationMinutes)
            {
                sessLogOut();
            }
            else
            {
                initSession();
                sessSetInterval();
                sess_lastActivity = new Date();
            }
        }
        else
        {
            sessLogOut();
        }
    }
}
</script>

HTML code:

 <body onload="initSession()" >

<form id="form1" runat="server">
<div>

</div>
</form>
 </body>
potatopeelings

Replace confirm with alert. The confirm has both Ok and Cancel. alert has only Ok.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to replace javascript message pop-up to Jquery message pop-up with only ok button option

From Dev

Yiiframework message pop up

From Dev

how to display a pop up message on clicking a button in windows phone 7

From Dev

javascript pop up message not coming on Delete

From Dev

How to animate or use transitions on a message pop up with javascript and css?

From Dev

jquery button in pop up

From Dev

How to pop up message on closing web browser

From Dev

How to pop up a message window in Qt?

From Dev

How to show a pop up message with dark background

From Dev

How to pop up message on closing web browser

From Dev

How to pop up a message while processing - python

From Dev

Pop up message on mouseover div

From Dev

Pop up message on selectindexchanged in vb

From Dev

Function for pop up message in HTML

From Dev

Pop Up Message On Excel Cell

From Dev

Gmail message sent Pop Up

From Dev

Pop-up ' Don't show this message again ' option

From Dev

javascript/Jquery pop up - only open one pop at a time

From Dev

Is it possible to make a pop up message without clicking on any button?

From Dev

Odoo 8 - How to create a button that contains a pop-up message with a refresh of the actual view?

From Dev

How would I make a message pop up after this form is submitted?

From Dev

How can we wait for a message text to pop up in selenium

From Dev

How to stop a message pop up confirm if validation fails

From Dev

How to do styling on buttons on a message box pop-up

From Dev

pop up a message box in jsp / servlet

From Dev

Customize Maya's addCheckCallback pop up message

From Dev

Pop up message if blob is detected, MATLAB

From Dev

Want to make a pop up message for the Error on Android

From Dev

Shiny R Date Input Pop Up message

Related Related

  1. 1

    How to replace javascript message pop-up to Jquery message pop-up with only ok button option

  2. 2

    Yiiframework message pop up

  3. 3

    how to display a pop up message on clicking a button in windows phone 7

  4. 4

    javascript pop up message not coming on Delete

  5. 5

    How to animate or use transitions on a message pop up with javascript and css?

  6. 6

    jquery button in pop up

  7. 7

    How to pop up message on closing web browser

  8. 8

    How to pop up a message window in Qt?

  9. 9

    How to show a pop up message with dark background

  10. 10

    How to pop up message on closing web browser

  11. 11

    How to pop up a message while processing - python

  12. 12

    Pop up message on mouseover div

  13. 13

    Pop up message on selectindexchanged in vb

  14. 14

    Function for pop up message in HTML

  15. 15

    Pop Up Message On Excel Cell

  16. 16

    Gmail message sent Pop Up

  17. 17

    Pop-up ' Don't show this message again ' option

  18. 18

    javascript/Jquery pop up - only open one pop at a time

  19. 19

    Is it possible to make a pop up message without clicking on any button?

  20. 20

    Odoo 8 - How to create a button that contains a pop-up message with a refresh of the actual view?

  21. 21

    How would I make a message pop up after this form is submitted?

  22. 22

    How can we wait for a message text to pop up in selenium

  23. 23

    How to stop a message pop up confirm if validation fails

  24. 24

    How to do styling on buttons on a message box pop-up

  25. 25

    pop up a message box in jsp / servlet

  26. 26

    Customize Maya's addCheckCallback pop up message

  27. 27

    Pop up message if blob is detected, MATLAB

  28. 28

    Want to make a pop up message for the Error on Android

  29. 29

    Shiny R Date Input Pop Up message

HotTag

Archive