So, I wanted to take the real size of a backgound image of a div, and searching in the site I found some great JavaScript code in this url: http://jsbin.com/olozu/2/edit.
However, it doesn't seem to work in my site and I can't find out why, though my code is identical to the above.
Here's my code (JS Bin)
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body onclick="picture()">
<img id="topicinfo" src="http://pierre.chachatelier.fr/programmation/images/mozodojo-original-image.jpg"><
</body>
</html>
JavaScript:
function picture()
{
var a=document.getElementById("topicinfo").height;
alert(a);
}
If you click the image on the left, it shows 0 width 0 height.