我可以在警报中使用锚标记吗?

时间:2014-09-15 11:32:59

标签: javascript jquery html

<script> 
 CheckFedderalTimeStatus(){
alert('Federal law restricts sending of mobile text messages between 9PM and 8AM of recipient`s local time. If you believe that the nature of your message does not fall under this restriction (e.g. emergency alert), please <a href="#inline1" class="fancybox" style="color:#1B91DA; text-decoration:none;">click here</a>to apply for an exception.'); 
}</script>
<a href="#" onclick="CheckFedderalTimeStatus()">Click ME </a>

我可以在警告框中使用锚标记

1 个答案:

答案 0 :(得分:3)

简单回答:不,你不能。警报内的HTML将显示为纯文本。

alert("This is a test: <a href='#'>is this a link?</a>. No it's not.");

结果:

>  This is a test: <a href='#'>is this a link?</a>. No it's not.

证明:http://jsfiddle.net/ao5od4gy/

您可以使用jQuery UI Dialog替代。