猿问

将 jQuery 对话框合并到 JavaScript 中时未打开

我在 JavaScript 函数中使用 jQuery 以显示对话以显示会话超时弹出窗口。出于某种原因,模型对话框根本没有打开。


我尝试移动 div 并尝试以 Internet 上显示的不同方式调用 jQuery,但仍然没有打开模型对话框。


timeout_popup_function = null;


function checkSession() {

    alert('Check session is called');

    var sessionExpiry = Math.abs(getCookie('sessionExpiry'));

    var timeOffset = Math.abs(getCookie('clientTimeOffset'));

    var localTime = (new Date()).getTime();

    alert("localTime is@@" + localTime);

    if (localTime - timeOffset > (sessionExpiry + 15000)) {

        var mins = 1;  //Set the number of minutes you need

        var secs = mins * 60;

        var currentSeconds = 0;

        var currentMinutes = 0;

        timeout_popup_function();

        setTimeout(Decrement(secs), 1000);

    }

    else {

        setTimeout('checkSession()', 10000);

    }

};


setInterval(checkSession, 30000);


$(function($) {

    function ShowTimeoutWarning() {

        alert('222');

        //$("#timeoutdialog").dialog("open");

        $("#timeoutdialog").dialog({

            autoOpen: false,

            dialogClass: "no-close",

            position: 'center',

            title: 'session',

            draggable: false,

            width: 300,

            height: 200,

            resizable: false,

            modal: true,

            buttons: [{

                text: "OK",

                click: function() {

                    ShowTimeoutWarning();

                    $(this).dialog("close");

                }

            }]

        });

        //return false;

    }

    timeout_popup_function = ShowTimeoutWarning;

})

HTML:

<div id="timeoutdialog" title="Session Expiry"

     style="display:none">

    <p>

        Your session will expire in</p>

        <p id="timerText">30</p>

        <p>. If you wish to extend your

            session, please click extend.

        </p>

</div>

我在这里缺少什么?


12345678_0001
浏览 105回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答