function writeDocument(variable)
{
document.write(variable + "<br/>");
}
writeDocument("生成随机验证码--------------");
function generateVerifyCode(length)
{
var strValue="237886781837dfjsknsdffSDFHIEFHHNS";
var code="";
for(var i=0;i<length;++i)
{
var randomIndex =Math.floor(Math.random()*strValue.length);
code += strValue.charAt(randomIndex);
}
return code;
}
writeDocument(generateVerifyCode(4));
writeDocument(generateVerifyCode(5));
writeDocument(generateVerifyCode(6));
writeDocument("用Math的方法找出3, 9, 15, 79, 45, 98中的最大值和最小值-------------");
writeDocument("最大值"+Math.max(3,9,15,79, 45, 98));
writeDocument("最小值"+Math.min(3,9,15,79, 45, 98));
//function shuzhi(a)
//{
// Math.max(a[i])
//}
writeDocument("请随机生成一个颜色值rgb(X, Y, Z)的函数,其中X,Y,Z表示的是0~255的数字---");
function getRandomColor()
{
var r= Math.floor(Math.random()*(255+1));
var g= Math.floor(Math.random()*(255+1));
var b= Math.floor(Math.random()*(255+1));
var rgb="rgb:("+ r + ","+g + ","+b + ","+")";
return rgb;
}
writeDocument(getRandomColor());
//writeDocument("请写一个随机生成颜色值rgb(X, Y, Z)的函数,其中X,Y,Z表示的是0~255的数字---");
console