0
Boas, I have a problem when I click on the object (e.g., square, or circle), it owed another object at another point between the margins. i have a variable var top and var left that define the size of the margins in the javascript script within the randomShape(){} function for when the object is clicked it generates another object at a different place.
This is the Javascript code.
var clickedTime, createTime, reactionTime;
function randomShape() {
var color = ["red", "blue", "green", "yellow"];
var codColor;
codColor = Math.random();
codColor = codColor * 4;
codColor = Math.floor(codColor);
document.getElementById("divbox").style.backgroundColor = color[codColor];
if (Math.random() > 0.5) {
document.getElementById("divbox").style.borderRadius = "100px";
} else {
document.getElementById("divbox").style.borderRadius = "0";
}
var top = Math.random();
top = top * 500;
var left = Math.random();
left = left * 800;
document.getElementById("divbox").style.top = top + "px";
document.getElementById("divbox").style.left = left + "px";
document.getElementById("divbox").style.display = "block";
}
It helps a lot if you put the code here and not elsewhere. It helps even more if you read the links above.
– Maniero
@Maniero already removed the links and put the code
– Elio Borges