<!DOCTYPE html>
<html>
<head>
<title>Button Homework</title>
<script>
function first() {
document.getElementById('type1').style.position = 'absolute';
document.getElementById('type1').style.left= "100px";
document.getElementById('type1').style.top= "200px";
var red = Math.floor(Math.random() * 256);
var green = Math.floor(Math.random() * 256);
var blue = Math.floor(Math.random() * 256);
var newColor = "rgb("+ red + "," + green + "," + blue +")";
}
function second() {
document.getElementById('type1').style.position = 'absolute';
document.getElementById('type1').style.left= "0px";
document.getElementById('type1').style.top= "80px";
}
</script>
</head>
<body>
<h1>Special Button</h1>
<input id = 'type1' type = 'button' value = 'Click' onclick = 'output();'
onmouseover= 'first()' onmouseout= 'second()';' />
</body>
</html>
I'm trying to get the button to change to random colors every time you hover over it but I can't seem to get it to work, If anybody knows how, please help me out. Thanks!