我想创建一个警告框的一些细节,但我的代码是不工作,请帮助我。
<script>
alert('<ul>
<li>Language must be in english .</li>
<li>Topic's must be on Digitalcoin.</li>
<li>Write a good title.</li>
<li>Don't give <b>Read More</b> button with other sites link.</li>
</ul>',{
ok : 'Ok'
})
</script>
3条答案
按热度按时间2izufjch1#
抱歉,您不能将html放入原生JavaScript的警报中。你可以使用jquery的dialog或bootstart的alert,这里的例子:
https://jqueryui.com/dialog/
http://www.w3schools.com/bootstrap/bootstrap_alerts.asp
eulz3vhy2#
您可以创建自己的自定义警告框以允许
html
标记。或者你可以使用像@epascarello提到的库。这是一个great article on how to create your own modal box with html5 and css3。我已经走在前面,创造了一个起点。这是jsfiddle。
uqzxnwby3#
您可以使用替代解决方案来解决此类问题,方法是创建包含某些内容的div元素,然后使用JavaScript切换隐藏/显示。代码如下: