Web Analytics Made Easy -
StatCounter DIV clientHeight = 0 despite I see, it is not - CodingForum

Announcement

Collapse
No announcement yet.

DIV clientHeight = 0 despite I see, it is not

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DIV clientHeight = 0 despite I see, it is not

    on the bottom of page is combobox(in fact it is not, just looks like it), click on its button.
    Why it returns clientHeight = 0 ?
    --->
    http://86.61.66.17:8084/AgroZoo/testHTML/testHTML.html

    thanks for help.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    try

    var height = obj.clientHeight > 0 ? obj.clientHeight : obj.offsetHeight;
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

    Comment


    • #3
      nope.

      implemented it -->
      http://86.61.66.17:8084/AgroZoo/testHTML/testHTML.html

      same thing
      Found a flower or bug and don't know what it is ?
      agrozoo.net galery
      if you don't spot search button at once, there is search form:
      agrozoo.net galery search

      Comment


      • #4
        I'm getting 26 in IE. What browser are you using?
        ||||If you are getting paid to do a job, don't ask for help on it!||||

        Comment


        • #5
          hmm truth, FF returns 0, any idea how to solve this ?
          Found a flower or bug and don't know what it is ?
          agrozoo.net galery
          if you don't spot search button at once, there is search form:
          agrozoo.net galery search

          Comment


          • #6
            Firefox doesn't support clientHeight. You should just be using offsetHeight. Don't worry about clientHeight.
            ||||If you are getting paid to do a job, don't ask for help on it!||||

            Comment


            • #7
              Originally posted by _Aerospace_Eng_ View Post
              Firefox doesn't support clientHeight. You should just be using offsetHeight. Don't worry about clientHeight.
              already suggested that, apperently it did not work.
              public string ConjunctionJunction(string words, string phrases, string clauses)
              {
              return (String)(words + phrases + clauses);
              }
              <--- Was I Helpfull? Let me know ---<

              Comment


              • #8
                hmm I m sure that clientHeight and clientWidth generaly works in FF, for example:

                Code:
                    var targetDIV = document.getElementById("MainFrame");
                    var dWidth = Math.floor(targetDIV.clientWidth/2);
                    var dLeft = targetDIV.clientWidth - dWidth - Math.floor(targetDIV.clientWidth/4);
                div palced on basis of dLeft gets centered horizontaly inside "MainFrame" in FF and IE
                Found a flower or bug and don't know what it is ?
                agrozoo.net galery
                if you don't spot search button at once, there is search form:
                agrozoo.net galery search

                Comment


                • #9
                  Originally posted by BubikolRamios View Post
                  hmm I m sure that clientHeight and clientWidth generaly works in FF, for example:

                  div palced on basis of dLeft gets centered horizontaly inside "MainFrame" in FF and IE
                  Then it must be something FF1.5 implemented because before it was a microsoft IE only thing. Why are you even worried about getting clientWidth of a div? Just use offsetHeight. It does work. If it doesn't for you then you are likely doing something incorrectly.
                  ||||If you are getting paid to do a job, don't ask for help on it!||||

                  Comment


                  • #10
                    I discovered this:
                    in FF:

                    Code:
                      <DIV id = 'test'>
                      </DIV>
                    or

                    Code:
                      <DIV id = 'test'>
                        <DIV id = 'test1'>
                        </DIV>
                        <DIV id = 'test2'>
                          <Img ....>   
                        </DIV>
                      </DIV>
                    clientHeight for 'test' allways returns 0, i.e if div contains nothing, or only other divs the client dimensions are 0, if jou place something/anything else inside it works OK


                    see purified version -->
                    http://86.61.66.17:8084/AgroZoo/testHTML/testHTML.html
                    Found a flower or bug and don't know what it is ?
                    agrozoo.net galery
                    if you don't spot search button at once, there is search form:
                    agrozoo.net galery search

                    Comment


                    • #11
                      nope, sorry, the above post is incorrect, forgot to change java script, the problem persists

                      see purified version -->
                      http://86.61.66.17:8084/AgroZoo/testHTML/testHTML.html
                      Found a flower or bug and don't know what it is ?
                      agrozoo.net galery
                      if you don't spot search button at once, there is search form:
                      agrozoo.net galery search

                      Comment


                      • #12
                        I give up. You don't seem to be listening to us. Just use offsetHeight. It works both in IE and FF as well as other browsers.
                        ||||If you are getting paid to do a job, don't ask for help on it!||||

                        Comment


                        • #13
                          I don't give up, but You don't seem to be listening to me !!! I tried offsetHeight too, but returns 0 just the same.

                          --> if jou look at the source yust once, specialy adopted for you (-:, you will see it.

                          see purified version -->
                          http://86.61.66.17:8084/AgroZoo/testHTML/testHTML.html
                          Found a flower or bug and don't know what it is ?
                          agrozoo.net galery
                          if you don't spot search button at once, there is search form:
                          agrozoo.net galery search

                          Comment


                          • #14
                            Its going to return 0 if its empty meaning you need something that takes up space. IE doesn't do the same thing because its always counting the line-height as space. Just place &nbsp; in the element and you get a height returned. How can you get a height of nothing? Think about it.
                            ||||If you are getting paid to do a job, don't ask for help on it!||||

                            Comment


                            • #15
                              hmm, the problematic DIV now contains 2 x <IMG .., and 1x another DIV. This is not empty, or is it ? And it is taking space.

                              yeah and I thought of &nbsp before,and clientHeight or offs.. works then but then it brakes my "combobox" outfit.
                              Found a flower or bug and don't know what it is ?
                              agrozoo.net galery
                              if you don't spot search button at once, there is search form:
                              agrozoo.net galery search

                              Comment

                              Working...
                              X