I need to add a modal on one classic ASP page, but inly if a cookie has not been set. i’d like to avoid javascript

I have a classic ASP page that needs a modal to pop up asking people to sign up to our mailing list. If they sign up, a cookie is set. This page checks for that cookie and doesn’t harass the user if they’ve already signed up (a cookie is set).

I saw a similar routine using a lot of JavaScript, but I couldn’t get it to work. (I’m very weak in JavaScript.)

So I tried the following using classic ASP and the bare minimum of Javascript, which doesn’t display the modal at all.

Here’s the basic code I’m working with.

<code>
<body>
<%
' Get the cookie
KeepInTouch = Request.Cookies("KeepInTouch")

if KeepInTouch <> "Y" then
%>
<script>
    document.getElementById('popup').style.display='block';
</script>
<div id="popup" class="w3-modal">
    <div class="w3-modal-content">
        <div class="w3-container">
            <!-- ... rest of popup ... -->
        </div>
    </div>
</div>
</body>`
</code>
    

I can't get the modal to pop up, even without checking for the cookie.