Bahasa Inggeris [ˈbækɡraund ˈkʌlə] AS [ˈbækˌɡraʊnd ˈkʌlɚ]

Warna latar belakang

javascript backgroundColor property sintaks

Fungsi: Tetapkan warna latar belakang elemen.

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

javascript backgroundColor property contoh

<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>

Run Instance »

Klik butang "Run Instance" untuk melihat instance dalam talian