<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#box {
position: relative;
left: 200px;
top: 100px;
width: 50px;
height: 50px;
background-color: rgb(125, 240, 115);
}
</style>
</head>
<body>
<button>開始</button>
<div id="box">
</div>
<script src="./tools.js"></script>
<script>
var oBox = getById('box');
var btn = getByTag('button')[0];
btn.onclick = function () {
move(oBox, 'left', 10, 600, function () {
move(oBox, 'top', 10, 500, function () {
move(oBox, 'left', 10, 200, function () {
move(oBox, 'top', 10, 100);
});
});
});
}
</script>
</body>
</html>