Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
  <link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css" type="text/css">
  
<title>JS Bin</title>
</head>
<body>
  <table id="tbl">
    <tr>
      <td>Cell 1</td>
      <td>Cell 2</td>
    </tr>
    <tr>
      <td>Cell 3</td>
      <td>Cell 4</td>
    </tr>
  </table>
  
  <button onclick="calc()">Calculate Offset Width</button>
  
  <div>Cell 1 offsetWidth: <span id="c1offWidth"></span>
  </div>
  
</body>
</html>
 
function calc(){
  document.getElementById('c1offWidth').innerHTML = document.getElementById('tbl').children[0].children[0].offsetWidth;
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers