首页 > 开发 > CSS > 正文

Javascript实例:JS函数实现随机颜色

2024-07-11 09:02:06
字体:
来源:转载
供稿:网友

武林网(www.vevb.com)文章简介:随机颜色。

function randomcolor()
{
var colorvalue=["0","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],
colorprefix="#",
index;
for(var i=0;i < 6; i++){
index=Math.round(Math.random()*14);
colorprefix+=colorvalue[index];
}
return colorprefix;
}
var test=randomcolor();
alert(test);

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表