国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

App下載
首頁javascriptwidthJavascript Style - 如何返回width的樣式屬性

Javascript Style - 如何返回width的樣式屬性

我們想知道如何返回width的樣式屬性。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#foo {
  background: green;
  width: 80px;
}
</style>
<script type='text/javascript'>
function getWidth() {
    var elem = document.getElementById("foo");
    var theCSSprop = window.getComputedStyle(elem, null).getPropertyValue("width");
    console.log(theCSSprop);
}

</script>
</head>
<body>
  <div id="foo" onClick="getWidth()">Hello World. click and check the console.</div>
</body>
</html>