NewDiv.style.background = OldDiv.style.background;
NewDiv.style.innerHTML = OldDiv.style.inHTML;
This should do the trick:
var element1 = document.getElementById("element1Id"); var element2 = document.getElementById("element2Id"); element2.style.background = document.defaultView.getComputedStyle(element1).background;
If you only want a certain portion of the background styling, instead of all at once, you can use any of the options below instead of "background."
more information about background styling can be found here
If you are curious why I used "document.defaultView.getComputedStyle" instead of "window.getComputedStyle" feel free to check out this StackOverflow Q/A that answers that question.
TL:DR; "document.defaultView.getComputedStyle" will work in all browsers