在关闭弹出窗口之前显示警报消息

发布于 2024-12-26 04:38:30 字数 191 浏览 4 评论 0原文

我有一个弹出窗口,其中包含是或否问题(单选按钮)。我想强制我的网站的用户在关闭弹出窗口之前选择其中一个选项,但我无法这样做。我可以使用弹出窗口上的“红色”十字按钮简单地关闭弹出窗口。

谁能告诉我如何阻止用户从此页面导航?有没有办法显示警报消息并要求他们选择一个选项?

我正在使用 C#.net、asp.net 和 JavaScript。

I have a popup with a yes or no question (radiobuttons) in it. I want to force the users of my site to select either one of the options before closing the popup, but i am not able to do so. I can simple close the popup using the 'RED' cross button on the popup.

Can anyone tell me how can i stop the users from navigating from this page? Is there a way to display a alert message and ask them to choose an option?

I am using C#.net, asp.net and JavaScript.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

并安 2025-01-02 04:38:30

没有 100% 的方法来吸引您网站的用户...您可以显示一个自制的弹出窗口,如下所示

#popupBox { 
    position: fixed;  
    width: 100%; 
    height: 100%;  
    background: rgba(0,0,0,.4); 
}

#popup {
    position: absolute;
    width: 300px;
    height: 200px;
    left: 50%,
    margin-left: -130px;
    top: 50%;
    margin-top: -100px;
}

<div id='popupBox'> 
    <div id='popup'>
        <button type='input' value='yes'>
        <button type='input' value='no'>
    </div>
</div>

插入弹出窗口后,必须重新加载所需的 javascript 以便单击此按钮之一...

There is no 100% way to hold the user of your site... You could show a selfmade popup something like this

#popupBox { 
    position: fixed;  
    width: 100%; 
    height: 100%;  
    background: rgba(0,0,0,.4); 
}

#popup {
    position: absolute;
    width: 300px;
    height: 200px;
    left: 50%,
    margin-left: -130px;
    top: 50%;
    margin-top: -100px;
}

<div id='popupBox'> 
    <div id='popup'>
        <button type='input' value='yes'>
        <button type='input' value='no'>
    </div>
</div>

After the insert of your popup ho have to reload the needed javascript for handel the click to one of this buttons...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文