Monday, July 18, 2016

function drawcolor(redval,greenval,blueval,square) {}

function drawcolor(redval,greenval,blueval,square) {

var left = ";left:" + (greenval * 10) + "%"
var top = ";top:" + (blueval * 10) + "%"
if (greenval < 9) {
var width = ";width:11%"}
else {var width = ";width:10%}
if ( blueval < 9) {
var height = ";height:11%"}
else {var height = ";height:10%"}

var r = redval * 25;var g = greenval * 25;var b = blueval * 25
var color = ";background-color:rgb(" + r + "," + g + "," + b + ")"

var color = document.createElement("div")
square.appendChild(color)
var styles = document.createAttribute("style")
color.setAttributeNode(styles)
styles.value = "position:absolute" + left + top + width + height + color

}









}