简体   繁体   English

如何在没有JavaScript的情况下实现弹出确认窗口

[英]how to implement a pop up confirmation window without javascript

我想实现一个没有javascript的确定和取消按钮的确认弹出窗口,我该如何在Java中这样做

Short answer- you can't. 简短的答案-您不能。 The ability to close a window (which is, I assume what you want the OK and/or Cancel buttons to do) is a javascript feature. 关闭窗口的功能(也就是说,我假设您要执行“确定”和/或“取消”按钮是一种JavaScript功能)。

If you don't care about closing the window, you can simply have a link in your web page that points to target="_blank" to open a new window. 如果您不希望关闭窗口,则只需在网页中拥有一个指向target =“ _ blank”的链接即可打开新窗口。

I'm not aware of any way to have a modal dialog box without having some form of client side script. 如果没有某种形式的客户端脚本,我不知道有什么方式可以创建模式对话框。 The nearest experience that you would be able to achieve is to redirect you application to a confirm/cancel screen when performing some action, but this may become extremely annoying for more trivial decisions 您将获得的最接近的体验是在执行某些操作时将应用程序重定向到确认/取消屏幕,但这对于更琐碎的决定可能会变得非常烦人

  1. Implement it in JavaScript. 用JavaScript实现。
  2. Check if JavaScript is enabled, if not, popup as message asking user to enable it. 检查是否启用了JavaScript,如果未启用,则弹出消息要求用户启用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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