...

View Full Version : can't get the div size !!!!



kennyTE
07-16-2007, 01:41 AM
hello,

i'm trying to get the div size, i try in Firefox, IE and Opera, but seems that, it can't get the div size once the picture is load in the DIV.

my code
====================== CODE ====================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<div id = 'holder'></div>
<script type='text/javascript'>
var info = "holder";

function create_image(in_data)
{
div_here = document.getElementById(in_data);
div_here.innerHTML = "<img border='0px' src='http://webzine2005.com/_img/wz.banner.336x280.gif' alt='picture'/>";
return in_data;
}

var check_ads = create_image(info);

if (check_ads == "holder")
{


var o = document.getElementById('holder');
if (o)
{
//////// function ///////////
function check_height()
{
if(o.offsetHeight > 25)
{
alert("Picture Loaded");
}
else
{
alert("Picture NOT Loaded");

}
}
//////// function ///////////
check_height();
}
else
{
alert("HOLDER DIV object Not found.");
}


}

</script>
</body>
</html>

================ END CODE ====================

Seems that we have to refresh the browser (firefox) in order to get the DIV size. IN IE, it is OK. In Opera, does't work at all.
i wonder how i can setInterval time to loop 3 times in each 15 second to check the div size, if 3 times looping still can get the div size, which mean the picture is not output properly. But how, can someone help me with it?

(note: the teory is, if the picture/swf file cannot been view in browser, the div size will be in 25 height, so we will know the image/swf file is not been output.)

note, i cannot use onload for some reason, and my lecturer is asking me to do it in DIV detection, i'm going crazy for this man.

can someone help me with it?

rwedge
07-16-2007, 04:02 AM
Is this how you call a function?
if (o)
{
//////// function ///////////
function check_height()
{



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum