简体   繁体   English

如何在 html 或 jquery 警报框中包含链接?

[英]How to Include links in html or jquery alert boxes?

When the website onload I just want a alert box which gives links.当网站加载时,我只想要一个提供链接的警报框。
I think we cannot add links in JavaScript alert box.我认为我们不能在 JavaScript 警报框中添加链接。
Is there any way we can include links in alert box any other box when the site is load?当网站加载时,有什么方法可以在警告框中包含任何其他框中的链接?
Thanks in advance.提前致谢。

You can use Jquery UI dialog box to show all links in popup on page load.您可以使用Jquery UI dialog box在页面加载时显示弹出Jquery UI dialog box所有链接。

You can show required html in jquery ui dialogbox您可以在 jquery ui 对话框中显示所需的 html

Please reffer: https://jqueryui.com/dialog/请参考: https ://jqueryui.com/dialog/

And there are also some other plugins available for displaying data in popup.还有一些其他插件可用于在弹出窗口中显示数据。

use window.confirm instead of alert使用window.confirm而不是alert

if (window.confirm('If you click "ok" you would be redirected . Cancel will load this website ')) 
{
  window.location.href='https://www.google.com/chrome/browser/index.html';
};

Yes, you can use an alert box that includes link.是的,您可以使用包含链接的警报框。

This is done by using a custom modal that acts as a alert box.这是通过使用充当警报框的自定义模式来完成的。

http://jquerymodal.com/ has examples on how can you do it. http://jquerymodal.com/有关于如何做到这一点的例子。

Try this试试这个

if (window.confirm('redirecting the website to google')) 
    {
      window.location.href='https://www.google.com/';
    };

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

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