var docColor = "Black"
Create a variable named docColor and set its value to the string "Black"
var strInnerHTML = prtContent.innerHTML;
Create a variable named strInnerHTML and set its value to the innerHTML value of the prtContent page element.
var strModifiedInnerHTMl = strInnerHTML.replace(/white/g, docColor);
Create a variable named strModifiedInnerHTML and set its value to a modified copy of strInnerHTML where any instances of "white" have been replaced by the current value of docColor(Which is currently "Black"). This is being done with a regular expression /white/ with a g switch indicating that it will update all instances that it finds.
WinPrint.document.write(strModifiedInnerHTMl);
Writes the strModifiedInnerHTML string to a WinPrint document object.
WinPrint.document.close();
Closes the WinPrint document
WinPrint.focus();
Gives the WinPrint object focus
WinPrint.print();
Sends the Winprint object to the printer
WinPrint.close();
Closes/Finished the WinPrint object. More than likely this call is required to clean up resources that the WinPrint object required to perform its actions.