简体   繁体   中英

I'm trying to load a popup from javascript, which works, however, when I click to close the popup it nothing happens

I've wrote the below code to load a popup when a page loads, however, when I click 'Continue' to close the popup - nothing happens. The button indents but the popup stays put. I was wondering if anybody had any ideas?

<p>This is the normal text that would be on the page anyway.</p>

<p>There's an awful lot of this text on a normal page with lots of graphics and stuff as well.</p>


<div id="reminderPopup">
    <div class="popupBackground">
        <div class="popupInner">
            <h2>Remember, if you have opened and resolved a complaint on this call to close the ADR.</h2>
            <p><!--additional text here--></p>
            <button id="close" onclick="closeReminderPopup()">Continue</button>
            <p>&nbsp;</p>
        </div>
    </div>
</div>

<script type="text/javascript"> 
function pageLoadCompleteEvent(){
    document.getElementById("reminderPopup").style.display="block";
};
function closeReminderPopup(){
    document.getElementById("reminderPopup").style.display="none";
};  
</script>

Your code works fine. Try running it in the code snippet tool:

  function pageLoadCompleteEvent(){ document.getElementById("reminderPopup").style.display="block"; }; function closeReminderPopup(){ document.getElementById("reminderPopup").style.display="none"; }; 
 <html> <body> <p>This is the normal text that would be on the page anyway.</p> <p>There's an awful lot of this text on a normal page with lots of graphics and stuff as well.</p> <div id="reminderPopup"> <div class="popupBackground"> <div class="popupInner"> <h2>Remember, if you have opened and resolved a complaint on this call to close the ADR.</h2> <p><!--additional text here--></p> <button id="close" onclick="closeReminderPopup()">Continue</button> <p>&nbsp;</p> </div> </div> </div> </body> </html> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM