tracerzzz,
function forIn(elem, obj) {
for (var k in obj) typeof obj[k] == "string" ? elem[k] = obj[k] : forIn(elem[k], obj[k]);
return elem
}
function add() {
var image = {
className: "alert",
id: "qwe",
innerHTML: "<img src='1.jpg' style='height:100%; width:100%;' >",
style: {
width: "999px",
border: "5px solid red"
}
};
var div = document.createElement("div");
div = forIn(div, image);
document.querySelector("#element").appendChild(div)
};