1) I want to change the CSS properties of a div so that it pops out like a modal when clicked. This CSS code changes the div's size and position to what I need:
#slot1{
position: absolute;
top: 10px;
left: 20%;
height: 600px;
width: 60%;
margin: auto;
}
2) For this I made a JS function that will let me change the CSS of the elements to the ones above:
function boxPop(id, cssValue, cssValue, cssValue, cssValue, cssValue)
{
document.getElementById(id).style.position = cssValue;
document.getElementById(id).style.top = cssValue;
document.getElementById(id).style.left = cssValue;
document.getElementById(id).style.height = cssValue;
document.getElementById(id).style.width = cssValue;
document.getElementById(id).style.margin = cssValue;
}
3) I added this with the desired parameters to the HTML element:
<div class="slot_content" id="slot1" onclick="boxPop('slot1', 'absolute',
'10px', '20%', '600px', '60%', 'auto')">
</div>
The result of all this is that it does change size and position, but not the way it does when I just paste the same values into the CSS (which does what I want). Does anyone know why the CSS values are not being assigned correctly by this function?