js window.open then print()

后端 未结 7 1885
深忆病人
深忆病人 2020-11-29 08:14

print() doesn\'t work in IE after opening a new window. It works in Chrome. Here\'s a tester:





        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 08:52

    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("

    This is 'myWindow'

    "); myWindow.document.close(); //missing code myWindow.focus(); myWindow.print(); }

提交回复
热议问题