当前位置:网站首页>The element of display:none cannot get offsetwidth and offsetHeight
The element of display:none cannot get offsetwidth and offsetHeight
2022-06-23 20:55:00 【It workers】
This chapter just shares a fact , That is, if an element is set to display:none Words .
We can't get offsetWidth and offsetHeight Property value .
The code example is as follows :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Front end tribe </title>
<style type="text/css">
#antzone {
width:200px;
height:200px;
display:none;
}
</style>
<script>
window.onload = function () {
var oantzone = document.getElementById("antzone");
var oshow = document.getElementById("show");
var obt = document.getElementById("bt");
obt.onclick = function () {
oshow.innerHTML = oantzone.offsetHeight;
}
}
</script>
</head>
<body>
<div id="antzone"></div>
<div id="show"></div>
<input type="button" id="bt" value=" See the effect "/>
</body>
</html>As can be seen from the above code ,antzone Elemental offsetheight Can not be obtained correctly .
边栏推荐
- [golang] type conversion summary
- How to build a personal cloud game server? How many games can the cloud game platform install?
- 国元期货交易软件正规吗?如何安全下载?
- 数字化采购转型解决方案:SaaS采购管理平台推进企业阳光采购
- How to solve the problem of large traffic audio audit? What are the common approval methods?
- How do I view the server when I log in to the fortress machine? Operation guide for novice
- [golang] follow the object pool sync Pool
- 【Golang】快速复习指南QuickReview(八)——goroutine
- 重庆 奉节耀奎塔,建成后当地连中五名进士,是川江航运的安全塔
- What is the main content of short video audit? What is illegal?
猜你喜欢
Implementing MySQL fuzzy search with node and express

Can the biggest gamefi crash victim survive the bear market in May| May Monthly Report

After the collapse of UST, will the stable currency market pattern usher in new opportunities?

JS advanced programming version 4: generator learning

35 year old crisis? It has become a synonym for programmers

JS高级程序设计第 4 版:生成器的学习

SQL聯合查詢(內聯、左聯、右聯、全聯)的語法

Yaokui tower in Fengjie, Chongqing, after its completion, will be the safety tower for Sichuan river shipping with five local scholars in the company

Applet development framework recommendation

The "open source star picking program" container pulls private images from harbor, which is a necessary skill for cloud native advanced technology
随机推荐
【Golang】怎样优雅的清空切片
How to build a cloud game platform on the server? How to select a cloud game server?
[golang] quick review guide quickreview (VIII) -- goroutine
How to deal with unclear pictures? How to deal with color balance?
What is the difference between a database and a cloud disk drive? What functions can cloud disk drives achieve?
小程序开发框架推荐
How to check whether the service is running normally after easydss cluster transcoding is set up?
Want to open an account, is it safe to open an account on the stock Internet? Will the funds be cheated away?
CPS 22 January additional incentive rules
How to process the text of a picture into a table? Can the text in the picture be transferred to the document?
[golang] some questions to strengthen slice
Kinsoku Jikou Desu Sina stock interface change
Sharelist supports simultaneous mounting of Google drive/onedrive multiple network disks
How to convert []byte to io. in go Reader?
How to use data warehouse to create time series
Tupu software digital twin intelligent water service, breaking through the development dilemma of sponge City
December 29, 2021: the elimination rules of a subsequence are as follows: 1. In a subsequence
How do I view the server when I log in to the fortress machine? Operation guide for novice
How do I close and restore ports 135, 139 and 445?
How does the fortress machine connect to the server? Novice must know operation steps