Turgut gave the right solution. Just for clarity, you need to add close after writing.
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.document.close(); //missing code
myWindow.focus();
myWindow.print();
}