使用javascript更改警报消息的文本颜色 [英] change alert message text color using javascript
本文介绍了使用javascript更改警报消息的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用下面的脚本来更改脚本的颜色,但是像这样显示'font color ="red"> Hello world/font>.这是更改警报文本颜色的任何可能的方法.
Am using the below script to change the color of the script but showing 'font color="red">Hello world /font> like this.Is any possible way to change the alert text color..
<html>
<head>
<title>JavaScript String fontcolor() Method</title>
</head>
<body>
<script type="text/javascript">
var str = new String("Hello world");
alert(str.fontcolor( "red" ));
</script>
</body>
</html>
推荐答案
否.alert()接受一个字符串,并使用本机窗口小部件呈现它.没有样式可以设置.
No. alert() accepts a string and renders it using a native widget. There is no provision to style it.
这篇关于使用javascript更改警报消息的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文