JavaScript警告框内的锚标记 [英] Anchor tag inside JavaScript alert box

查看:88
本文介绍了JavaScript警告框内的锚标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



有没有办法解释JavaScript警告框中的html内容?



我们需要在警告框内显示锚标记,但它显示html标记而不是呈现链接。



演示代码如下。

Hi all,

Is there a way to interpret the html contents inside the JavaScript alert box ?

We need to show anchor tag inside the alert box, but it shows the html markup instead of rendering the link.

The demo code is as below.

<html>
    <head>
        <script type="text/javascript" language="javascript">
        function show()
        {
            alert('<a href="http://www.codeproject.com/">Code Project</a>');
        }
        </script>
    </head>
    <body>
        <input type="button" id="show" value="show" onclick="show()">
    </body>
</html>



此处警告框显示如下所示的锚点html,但不是作为一个链接。


Here the alert box shows the html of anchor like below, but not as one link.

<a href="http://www.codeproject.com/">Code Project</a>



我知道我们ca n通过 jQuery 模式执行此操作,但如果有人通过覆盖默认行为尝试在JavaScript中执行此操作,请分享。



在此先感谢,

Tadit


I know that we can do this by jQuery modal, but still if anybody has tried doing it in JavaScript by overriding the default behavior, then please share.

Thanks in advance,
Tadit

推荐答案

您可以使用div而不是使用确认框。

请参阅此链接如何进行浮动和调光Div使用JavaScript [ ^ ]
You can use a div instead of using the confirm box.
Refer this link How To Make Floating and Dimming a Div using JavaScript[^]


这篇关于JavaScript警告框内的锚标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆