<html>
<head><title>Web Safe Colours</title>
<style type="text/css" media="all">
.webColors {
display: inline-block;
width: 65px;
height: 25px;
}
</style>
<body onload="palette()">
<div id="colors"></div>
</body></head>
</html>
function palette(){
var components = ['00', '33', '66', '99', 'CC', 'FF'];
for(var red = 0; red < components.length; red++){
for(var green = 0; green < components.length; green++){
for(var blue = 0; blue < components.length; blue++){
var colorDiv = document.createElement('div');
colorDiv.className = 'webColors';
colorDiv.innerHTML= '#' + components[red] +
components[green] + components[blue];
colorDiv.style.backgroundColor =
'#' + components[red] + components[green] +
components[blue];
colors.appendChild(colorDiv);
if(blue=== 5){
var br =
document.createElement('br');
colors.appendChild(br);
}
}
}
}
Output:
}
(b) Write a JavaScript function that displays the 216 web safe colours with their hex values in a 36 × 6 table. In an R...