Why it is impossible to write in variable values ​​of styles?

var display = login.style.display //display == пусто 
  • 2
    alert (login.style.display); Displays what? - Rimon
  • is empty ((((( - Zow

1 answer 1

This means that the "login.style.display" itself is empty, since you cannot withdraw it by alert.

  • Why is it empty? I ordered display: none ;? - Zow
  • one
    hmm ... and if the style is not prescribed through CSS, but through the same Java? - Rimon
  • one
    CSS style and style of element 2 are ABSOLUTELY different things. Roughly - in the way of el.style.someSteleProp you can read only those styles that one way or another (either immediately in html, or dynamic, ie initialized with JS) - Zowie