如何弹出" POP"只有一次?

时间:2015-01-21 11:04:21

标签: javascript jquery popup unbind

我想让我的弹出窗口只在屏幕上显示一次。如何让它弹出一次?基本上,我不知道如何取消绑定事件。任何人都可以指导我吗?

CODE:

<!DOCTYPE html> 
<html > 
    <head> 
        <style type="text/css"> 
            .button { 
                width: 150px; 
                padding: 10px; 
                background-color: #FF8C00; 
                box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2); 
                font-weight:bold; 
                text-decoration:none; } 
            #cover{ 
                position:fixed; 
                top:0; 
                left:0;
                opacity:2; 
                background:rgba(0,0,0,0.6); 
                z-index:5; 
                width:100%; 
                height:100%; 
                display:none; } 
            #loginScreen { 
                height:500px; 
                width:760px; 
                margin:0 auto; 
                position:relative; 
                z-index:10; 
                display:none; 
                background: url(login.png) no-repeat; 
                border:5px solid #cccccc; 
                border-radius:10px; } 
            .cancel { 
                display:block; 
                position:absolute; 
                top:3px; 
                right:2px; 
                background:rgb(245,245,245); 
                color:black; 
                height:30px; 
                width:35px; 
                font-size:30px; 
                text-decoration:none; 
                text-align:center; 
                font-weight:bold; } 
        </style> 
    </head> 
    <body> 
        <a href="javascript:;" class="button" onmouseover="toggleLoginPopup('open')">
    Hover here to Log In
</a> 
        <div id="loginScreen">
            <iframe src="https://docs.google.com/forms/d/1L826uHnryrePQzl8g3YjMHMrA0K80gG7bEEwMSuObHc/viewform?embedded=true" 
                width="760" 
                height="500" 
                frameborder="0" 
                marginheight="0" 
                marginwidth="0">
                Loading...
            </iframe>
            <a href="javascript:;" class="cancel" onclick="toggleLoginPopup('close')">
    &times;
</a> 
        </div> 
        <div id="cover" > 
        </div>
<script type="text/javascript">
    function toggleLoginPopup(action) {
        var loginScreen = document.getElementById('loginScreen');
        if (action === 'open') {
            loginScreen.style.display = "block";
        } else {
            loginScreen.style.display = "none";
        }

    }
</script>
    </body> 
</html>

0 个答案:

没有答案