|
| auteur : siddh |
On remplace les "-" par une majuscule sur le mot suivant.
Exemples :
- z-index element.style.zIndex
- background-color element.style.backgroundColor
|
|
| auteurs : simone.51, denisC |
On a quelques fois besoin de faire apparaître ou masquer certains objets. Comme par exemple pour des info-bulles, des menus, ...
Voici deux fonctions qui permettent de faire apparaître ou disparaître un objet passé en paramètre.
function afficher(obj){
document.getElementById(obj).style.display = "block";
}
function cacher(obj){
document.getElementById(obj).style.display = "none";
}
|
|
|
| auteur : denisC |
On peut acceder au style réel (celui qui prends en comptes toutes les
règles des container et des class d'un élément) de la façon suivante:
element.currentStyle
window.getComputedStyle(element, null)
|
L'objet résultant de ces deux fonctions a les mêmes propriétés que l'attribut
style d'un élément normal.
Pour un script cross-navigateurs:
elementCptedStyle = element.currentStyle || window.getComputedStyle(element, null);
|
|
|
| auteur : BrYs |
Voila la table de correspondance entre propriété CSS et attribut javascript
de la variable style correspondant:
| attributs CSS |
propriété Javascript |
| text-decoration |
textDecoration |
| text-indent |
textIndent |
| text-transform |
textTransform |
| list-style |
listStyle |
| list-style-image |
listStyleImage |
| list-style-position |
listStylePosition |
| list-style-type |
listStyleType |
| padding-bottom |
paddingBottom |
| padding-left |
paddingLeft |
| padding-right |
paddingRight |
| padding-top |
paddingTop |
| page-break-after |
pageBreakAfter |
| page-break-before |
pageBreakBefore |
| 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-width |
borderTopWidth |
| border-width |
borderWidth |
| margin-bottom |
marginBottom |
| margin-left |
marginLeft |
| margin-right |
marginRight |
| margin-top |
marginTop |
| line-height |
lineHeight |
| letter-spacing |
letterSpacing |
| vertical-align |
verticalAlign |
| z-index |
zIndex |
| background-attachment |
backgroundAttachment |
| background-color |
backgroundColor |
| background-image |
backgroundImage |
| background-position |
backgroundPosition |
| background-repeat |
backgroundRepeat |
Les autres propriétés ont le même format en CSS et en Javascript
(border, font, margin, overflow, padding, position, ...).
|
Consultez les autres F.A.Q's


Les sources présentées sur cette page sont libres de droits
et vous pouvez les utiliser à votre convenance. Par contre, la page de présentation
constitue une œuvre intellectuelle protégée par les droits d'auteur.
Copyright © 2004 Developpez Developpez LLC.
Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne
peut être faite de ce site ni de l'ensemble de son contenu : textes, documents
et images sans l'autorisation expresse de Developpez LLC. Sinon vous encourez
selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.