Custom Search

klik ubah warna

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function cap(hasil)
{
var warna= new Array("red","blue","green","yellow")

document.getElementById("tembakwarna").style.backgroundColor=warna[hasil];
}
</script>
</head>

<body>
<a href="#" name="a" id="a" onclick="cap(0)">red</a>
<a href="#" name="b" id="b" onclick="cap(1)">blue</a>
<a href="#" name="c" id="c" onclick="cap(2)">green</a>
<a href="#" name="c" id="c" onclick="cap(3)">yellow</a>


<div id="tembakwarna" name="tembakwarna">hasil</div>

</body>
</html>