Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy can't get the div size !!!!

    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?

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    Is this how you call a function?
    Code:
    if (o)
    {
    //////// function ///////////
    function check_height()
    {


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •