此方法使字符串以指定的颜色显示,就像在<font color =“ color”>标签中一样。
string.fontcolor( color )
COLOR - 将颜色表示为十六进制RGB三元组或字符串文字的字符串。
返回带有<font color =“ 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>
运行上面代码输出
链接:https://www.learnfk.comhttps://www.learnfk.com/javascript/string-fontcolor.html
来源:LearnFk无涯教程网
<font color="red">Hello world</font>
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)