mercredi 17 février 2021

How to make a button that teleports randomly on the website onclick [closed]

At the moment I wanted to create a button that teleports randomly back and forth on my website. As I am very new to JavaScript, I did not get it right. That's why I don't have a code. I found this question but it didn't help me.

Here's the Code i used:

document.getElementById("button").style.margin = Math.floor(Math.random() * 100);
<button id="button">Teleport</button>

Do you have any ideas how I could do this with HTML, CSS and JavaScript?

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire