//url参数
<body>
<script>
//当我们鼠标按下,就获得鼠标在盒子内的坐标
title .addEventListener('mousedown', function(){
var x =e.pageX -login.offsetLeft;
var y=e.pageY-login.offsetTop;
document.addEventListener('mousemove',move)
function move(e) {
login.style.left =e.pageX -x+'px';
login.style.top =e.pageY -y +'px';
}
//鼠标弹起。就让鼠标移动事件移除
document.addEventListener('mouseup',function(){
document.removeEventListener('mousemove',move);
})
})
</script>
</body>
//定时器 网页效果就是开始和停止定时器两个按钮框
<body>
<button class="begin">开启定时器</button>
<button class="stop">停止定时器</button>
<script>
var begin=document.querySelector('.begin');
var stop =document.querySelector('.stop');
begin.addEventListener('click',function(){
setInterval(function(){
console.log('nihaom');
},3000);
})
</script>
</body>