Wolfie7873
Technical User
The Alert box is blank. Why?
Code:
<script type='text/javascript'>
function changeColor(x) {
var mycolor = x.style.backgroundColor;
alert(mycolor);
var myDiv = document.getElementById('bigOval');
myDiv.style.backgroundColor = color;
}
</script>
<body>
<div class='main-container'>
<div class='button black-border' id='button1' onclick="changeColor(this)">1</div>
<div class='button black-border' id='button2' onclick="changeColor(this)">2</div>
<div class='button black-border' id='button3' onclick="changeColor(this)">3</div>
<div class='button black-border' id='button4' onclick="changeColor(this)">4</div>
<div class='button black-border' id='button5' onclick="changeColor(this)">5</div>
<div class='sub-container black-border' id='bigOval'>
<div class='content-box'></div>
</div>
</div>
</body>