How can i find out the size of a cell with javascript

后端 未结 4 891
盖世英雄少女心
盖世英雄少女心 2021-01-28 19:06

I have a popup that pops up right underneathe a so it looks like the (don\'t ask why). on 1024 *760 its the same width as the tab

4条回答
  •  心在旅途
    2021-01-28 19:21

    var element = document.getElementById('whatever');
    //or however you want to get the element
    var width;
    if (typeof element.clip !== "undefined") { width = element.clip.width; } 
    else {
        if (element.style.pixelWidth) { width = element.style.pixelWidth; } 
        else { width = element.offsetWidth; } 
    } 
    

提交回复
热议问题