Menu
Here is my js function:
function setNewsPosition()
{
position=document.getElementById(“image_1”).width;//returns value
newsWidth= document.getElementById(“news”).width;//returns unassigned
alert(position);
var news= document.getElementById(“news”);
news.style.left= position + newsWidth + ‘px’;
}
Here is the css part that concerns the function:
div#news
{
float:left;
width:25%;
margin-left:-25%;
background:#0099cc;
}
I first thought it is because of the percentage value, but I’ve switched to px and it still returned unassigned. Does anyone have a suggestion why this might be and how it could be fixed.
Greetings,
Valentin