简体   繁体   English

创建一个表单提交按钮,当用户单击鼠标右键时启用“在新窗口中打开”吗?

[英]Create a form submit button that enables “open in new window” when the user right clicks?

I have a form submit button that I need to enable the user to be able to right click and get the "open in new window" option, so that the user can have the option of either submitting the form in the current window (by simply clicking the button) or in a new window (by right clicking and selecting "open in new window"). 我有一个表单提交按钮,我需要使用户能够右键单击并获得“在新窗口中打开”选项,以便用户可以选择在当前窗口中提交表单(通过简单地单击按钮)或在新窗口中(通过右键单击并选择“在新窗口中打开”)。 Is this possible? 这可能吗?

I know I could sort of do this via creating a stand-alone link/image and use css to make it look like a button, and then use onclick to submit the form when clicked, but this would not work for users that does not have javascript. 我知道我可以通过创建一个独立的链接/图像并使用css使其看起来像一个按钮,然后在单击时使用onclick提交表单来做到这一点,但这对于没有该功能的用户不起作用javascript。

UPDATE: To clarify, I am looking for a way to do this without using javascript, or confirm that it is actually impossible to do so without using javascript. 更新:为澄清起见,我正在寻找一种无需使用javascript即可做到这一点的方法,或者确认如果不使用javascript则实际上是不可能做到的。

您可以做的就是按照您的建议使用CSS的独立链接/图像,然后在Javascript不可用时使用<noscript>标记将其替换为传统的表单按钮。

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

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