Tłumacz
Kategorii
Archiwum

Ustaw styl dynamicznie JavaScript

Zmiana stylu obiekt jest tak proste jak znalezienie obiektu na stronie, to ustawienie nowej wartości stylu. Użyj poniższego kodu jako przykład.

 / / Znajdź div chcesz zaktualizować
 var divArray = document.getElementById ("myDiv ');
 / / Ustaw szerokość stylu
 divArray.style.width = '300px ";

CSS atrybutu nazwy są nieco inne w przypadku stosowania w JavaScript, więc trzeba będzie odwołać się do poniższej listy, zanim pojawi się sfrustrowani i ciągnąć twój włos na zewnątrz.

Do atrybutów CSS JavaScript Reference
Własności CSS JavaScript Reference
tło tło
background-attachment backgroundAttachment
background-color backgroundColor
background-image Backgroundimage
background-position backgroundPosition
background-repeat backgroundRepeat
granica granica
border-bottom borderBottom
border-bottom-color borderBottomColor
border-bottom-style borderBottomStyle
border-bottom-width borderBottomWidth
border-color borderColor
border-left borderLeft
border-left-color borderLeftColor
border-left-style borderLeftStyle
border-left-width borderLeftWidth
border-right borderRight
border-right-color borderRightColor
border-right-style borderRightStyle
border-right-width borderRightWidth
border-style BorderStyle
border-top borderTop
border-top-color borderTopColor
border-top-style borderTopStyle
border-top szerokości borderTopWidth
border-width borderWidth
jasny jasny
klips klips
kolor kolor
kursor kursor
wystawa wystawa
filtr filtr
font font
font-family fontFamily
font-size fontSize
font-variant fontVariant
font-weight Szerokość Czcionki
wysokość wysokość
lewo lewo
list-spacing letterSpacing
line-height lineHeight
list-style listStyle
list-style-image listStyleImage
list-style-position listStylePosition
list-style-type listStyleType
margines margines
margin-bottom marginBottom
margin-left marginLeft
margin-right marginRight
margin-top marginTop
przelewowy przelewowy
wyściółka wyściółka
padding-bottom paddingBottom
padding-left paddingleft
padding-right paddingRight
padding-top paddingTop
page-break-after pageBreakAfter
page-break-before pageBreakBefore
miejsce miejsce
pływak styleFloat
text-align textAlign
text-decoration textDecoration
text-decoration: blink textDecorationBlink
text-decoration: line-through textDecorationLineThrough
text-decoration: none textDecorationNone
text-decoration: overline textDecorationOverline
text-decoration: underline textDecorationUnderline
text-indent textIndent
text-transform textTransform
top top
vertical-align wyrównanie pionowe
widoczność widoczność
szerokość szerokość
z-index zIndex

Leave a Reply