function indeIm(btnId,boxId,step,target){
var btn=document.getElementById(btnId);
var box=document.getElementById(boxId);
//定义变量
var timer=null,begin=0;
//监听点击事件
btn.onclick=function(){
//清除定时器
clearInterval(timer);
//启动定时器
timer=setInterval(function(){
//相加
begin+=step;
//判断
if(begin>=target){
begin=target;
clearInterval(timer);
}
console.log(begin);
//动
box.style.marginLeft=begin+'px';
},100)
}
}