<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div{
position: absolute;
}
</style>
</head>
<body>
<div id="kvadrat">
<div id="kvadr">1</div>
</div>
</body>
<script>
var left = 0;
window.onkeydown = function move_left(){
if(event.keyCode==37){
left=left-10;
document.getElementById('kvadr').style.left = left + 'px';
}
else if(event.keyCode==39){
left=left+10;
document.getElementById('kvadr').style.left= left + 'px';
}
};
</script>
</html>