Skip to content

Instantly share code, notes, and snippets.

@tataranovich
Created September 4, 2021 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tataranovich/e691fdf31762a6c44583fd153a0514cd to your computer and use it in GitHub Desktop.
Save tataranovich/e691fdf31762a6c44583fd153a0514cd to your computer and use it in GitHub Desktop.
Monitor test
<!DOCTYPE html>
<html>
<head>
<title>Monitor test</title>
<script>
let colors = ["#ff0000", "#00ff00", "#0000ff"];
let i = 0;
function switchcolor() {
document.body.style.backgroundColor = colors[i];
if (i < 2) {
i = i + 1;
} else {
i = 0;
}
}
</script>
</head>
<body style="width: 100vw; height: 100vh; margin: 0" onclick="switchcolor()" onload="switchcolor()">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment