javascript 如何使用锚标签在按钮点击时弹出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30507219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 12:18:08  来源:igfitidea点击:

How to get popup on button click using anchor tag?

javascripthtmlcss

提问by Ivin Raj

I want to get a popup on clicking the anchor tag .And also I want the background to hide or blur.

我想在单击锚点标签时弹出一个窗口。我还希望背景隐藏或模糊。

This is My code :

这是我的代码:

<a class="button fifteen"><strong>Visit Our Website</strong></a>

回答by developer

Try as below: (Reference)

尝试如下:(参考

 <a href="javascript:void(0);" onclick="window.open(url, '_blank', 'width=300,height=250');">test</a>

for the functionality to click working in popup , try as below:

对于在弹出窗口中单击工作的功能,请尝试如下操作:

<a href="yourLink"  target="popup"  onclick="window.open('yourLink','popup','width=600,height=600,scrollbars=no,resizable=no'); return false;">
    Open Popup
</a>

回答by edc65

With this code you'll get a popup.

使用此代码,您将获得一个弹出窗口。

<a class="button fifteen" onclick="alert('hello!');return false;"><strong>Visit Our Website</strong></a>

Probably not what you need, try to be more specific in your question.

可能不是您需要的,请尝试在您的问题中更具体。