+ 9
Can javascript calculate result from mixing colors?
I found this comment.
3 Respuestas
+ 8
yes
<button onclick="getRandomColor()">Background color change</button>
<script>
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * 16)];
}
var q = document.getElementsByTagName("body")[0];
q.style.backgroundColor = color;
}
</script>
+ 4
Shudarshan Rai👑
thanks, I'll try it out then.
+ 4
👌