乘法表,随机验证码
九九乘法表
span{
border:1px solid blue;
width: 100px;
height: 50px;
line-height: 50px;
background:pink;
display: inline-block;
}
document.write("<center>");
for(var i=1;i<=9;i++){
for(var b=1;b<=i;b++){
document.write("
<span>"+b+""+i+"="+ib+" "+"</span>");
}
document.write("
")
}
document.write("<center>");
6.点击随机验证码,产生4位随机验证码(26个字母大小写和数字0-9)放到div中,点击变换背景颜色按钮改变body背景颜色
var odiv=document.getElementById("div");
var ob1=document.getElementById("b1");
var ob2=document.getElementById("b2");
var str="zxcvbnmasdfghjklpoiTYUIOPASDFGHJKLZXNMNCBVuytrewq1234567890QWER"
ob1.onclick=function(){
var a=parseInt(Math.random()str.length);
var b=parseInt(Math.random()str.length);
var c=parseInt(Math.random()str.length);
var d=parseInt(Math.random()str.length);
odiv.innerHTML=str[a]+str[b]+str[c]+str[d];
ob2.onclick=function(){
var ys="#"+parseInt(Math.random()*(999999-100000+1)+100000);
document.body.style.background=ys;
}
}