当前位置:网站首页>Why is it invalid to assign values to offsetwidth and offsetHeight
Why is it invalid to assign values to offsetwidth and offsetHeight
2022-06-23 20:56:00 【It workers】
This chapter introduces a problem that is easy to occur among beginners , to offsetWidth and offsetHeight Invalid assignment .
Invalid assignment is a correct phenomenon , Because it is a read-only attribute .
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:100px;
background:#ccc;
}
</style>
<script>
window.onload = function () {
var antzone = document.getElementById("antzone");
antzone.offsetHeight = 200;
}
</script>
</head>
<body>
<div id="antzone"></div>
</body>
</html>because offsetWidth and offsetHeight Is a read-only property , So the assignment failed .
边栏推荐
- 实现vscode写markdown文档+图片自动上传至腾讯云cos
- December 29, 2021: the elimination rules of a subsequence are as follows: 1. In a subsequence
- How to build a personal cloud game server? How many games can the cloud game platform install?
- JS takes two decimal places
- JS高级程序设计第 4 版:生成器的学习
- How to deal with unclear pictures? What are the techniques for taking clear pictures?
- 【Golang】快速复习指南QuickReview(四)——函数
- How PostgreSQL quickly locate blocking SQL
- After the collapse of UST, will the stable currency market pattern usher in new opportunities?
- Do you need a server to set up cloud on demand? What services can cloud on demand provide?
猜你喜欢

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

Rstudio 1.4 software installation package and installation tutorial

Importance and purpose of test

重庆 奉节耀奎塔,建成后当地连中五名进士,是川江航运的安全塔

Tupu software digital twin intelligent water service, breaking through the development dilemma of sponge City

Tcp/udp Fundamentals

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

Syntaxe des requêtes fédérées SQL (inline, left, right, full)

「开源摘星计划」Containerd拉取Harbor中的私有镜像,云原生进阶必备技能

Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
随机推荐
How is the picture mosaic clear? What is mosaic for?
Install bitgarden open source password manager
Row height, (top line, middle line, baseline, bottom line), vertical align
【Golang】快速复习指南QuickReview(三)——map
What is the role of short video AI intelligent audit? Why do I need intelligent auditing?
Emmet语法规范
【Golang】快速复习指南QuickReview(四)——函数
JS five methods to judge whether a certain value exists in an array
Dart series: your site is up to you. Use extension to extend classes
Sharelist supports simultaneous mounting of Google drive/onedrive multiple network disks
Is Guoyuan futures trading software formal? How to download safely?
【Golang】使用Go语言操作etcd——配置中心
[golang] quick review guide quickreview (I) -- string
[golang] quick review guide quickreview (VII) -- Interface
[golang] reexamine closures from the perspective of go language
Kubernetes resource topology aware scheduling optimization
. Net cloud native architect training camp (rgca four step architecture method) -- learning notes
国元期货交易软件正规吗?如何安全下载?
JS mailbox regular expression
JS naming conventions