Anglais [?b?kɡraund ?k?l?] US [?b?k?ɡra?nd ?k?l?]

Couleur de fond

propriété javascript backgroundColor syntaxe

Fonction?: Définissez la couleur d'arrière-plan de l'élément.

Syntaxe?: Object.style.backgroundColor=color-name|color-rgb|color-hex|transparent

propriété javascript backgroundColor exemple

<html>
<head>
<style type="text/css">
body
{
background-color:#B8BFD8;
}
</style>
<script type="text/javascript">
function changeStyle()
{
document.body.style.backgroundColor="#FFCC80";
}
</script>
</head>
<body>

<input type="button" onclick="changeStyle()"
value="Change background color" />

</body>
</html>

Exécuter l'instance ?

Cliquez sur le bouton ??Exécuter l'instance?? pour afficher l'instance en ligne