I'm making simple 2D solar system in js.
I'm in the stage where I have few planets orbiting around the sun and even few moons.
I wanted to make simple script that would create dots I place where my planets currently are to draw their orbits.
So my code looks like this :
var drawtime = setInterval(createdot,1000);
function createdot(){
var dot = document.createElement('div');
var dotleft = document.getElementById('earth').style.left;
var dottop = document.getElementById('earth').style.top;
dot.setAttribute(hight, '1000px');
dot.setAttribute(width, '1000px');
dot.setAttribute(position, absolute);
dot.setAttribute(background, '#FFFFFF');
dot.style.top = dottop +'px';
dot.style.left = dotleft +'px';
};
dotleft/top is current place where my earth is.
I'm new to programming and I don't know even this idea is good. I was looking through internet and trying few methods but none of them worked. If you could help me and explain the process, that would be great. Thanks