Change element color by setting the color style : Color « Style « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function colorchange()
{
    head1.style.color = "red";
}

function colorchangeback()
{
    head1.style.color = "black";
}
//  -->
</script>
</head>
<body>
<h1 id="head1" onMouseover="colorchange()" onMouseout="colorchangeback()">
Welcome to this page!</h1>
<P>A lot of interesting text goes here!</p>
</body>
</html>








22.2.Color
22.2.1.Change element color by setting the color style
22.2.2.div.style.color="#fff";