Setting properties with style in JS always reports that it is undefined

problem description

the environmental background of the problems and what methods you have tried

The function of

is a magnifying glass. After you use style.left to indicate that left is not defined, use style.marginTop to indicate that MarginTop is not defined, and debug all the time, but you don"t know what"s wrong

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

clipboard.png

Dec.24,2021

see if this DOM exists.


it is very likely that the DOM object of the operation does not get a value, and it is not a matter of style

Menu