confirm可弹出窗口,让用户选择是还是否
//弹出窗口询问用户是否更改?
var answer = confirm ("您需要设置前景色和背景色吗?");
if(answer)
{
//设置前景色 ,分别设置三个通道
app.foregroundColor.rgb.red = Math.random()*255;
app.foregroundColor.rgb.green = Math.random()*255;
app.foregroundColor.rgb.blue = Math.random()*255;
//设置背景色 ,分别设置三个通道
app.backgroundColor.rgb.red = Math.random()*255;
app.backgroundColor.rgb.green = Math.random()*255;
app.backgroundColor.rgb.blue = Math.random()*255;
}
设置为RGB值为0-255随机值,即合成随机色
来源:https://www.cnblogs.com/52vsto/p/12255778.html