function writeDocument(variable) {
document.write(variable + "<br/>");
}
writeDocument("最大值最小值---------------")
writeDocument("最大值:"+Math.max(1,3,9,10,18,999));
writeDocument("最大值:"+Math.min(1,3,9,10,18,999));
writeDocument("生成四位数随机验证码--------------------")
function generateVerifyCode(length){
var strletterNumber="0123456789ABCDEFGHIJKLMNOPQRSTUVWSYZ"
var code="";
for(var i=0;i<length;++i){
var randomNumber =Math.floor(Math.random()*strletterNumber.length);
code=code+strletterNumber.charAt(randomNumber);
}
return code;
}
writeDocument(generateVerifyCode(4));
writeDocument("生成随机的颜色 rgb(255, 255, 255)----------------")
function rgb(){
var r = Math.floor(Math.random()*256);
var g = Math.floor(Math.random()*256);
var b = Math.floor(Math.random()*256);
var rgb = '('+r+','+g+','+b+')';
return rgb;
}
writeDocument(rgb());
console