1.效果图
随机图片位置
2.获取事件源对象,按钮
var button=document.querySelector("#btn_1");
var input_1=document.querySelector("#input_1");
3.绑定事件
button.onclick=function(){
// alert("绑定成功");
addElement();
changeColor();
// var bgColor="";
// for(var i=0; i<6; i++){
// bgColor += '' + Math.round(Math.random()*9);
// }
// document.body.style.backgroundColor='#'+bgColor;
}
4.在随机生成图片的基础上,加上随机改变页面的背景色
function changeColor(){
var body=document.body;
var R=Math.random()*255;
var G=Math.random()*255;