我需要一個js代碼,在出現彈出窗口後立即關閉窗口。這是我的代碼:window.close();在window.print();之後javascript
<a href="javascript:;" onclick="print()">Print</a>
function print()
{
win = window.open();
win.document.write('<html><head>blablabla.......');
win.window.print();
win.window.close();
}
但它不起作用,因爲窗口在它彈出之前關閉。
刪除'win.window.close();' –
@DontVoteMeDown關閉window..how地球上這將工作..你應該保持活動窗口,直到你打印...並且不要辱罵和冒犯..凱? –
我想你可以找到你要找的[這裏](http://stackoverflow.com/questions/6460630/close-window-automatically-after-printing-dialog-closes) – Stilltorik