変更した JavaScript 要素を出力するこのコードを見つけました。document.title
と<title></title>
タグを追加しましたが、通常のテキスト エディターで開くウィンドウには と表示されますuntitled
。
これは通常、テキストが保存される前の状況です。とにかくタイトルを表示する方法はありますか?
var element=document.getElementById(element_id);
var newWin=window.open('','Print-Window','width=400,height=400,top=100,left=100');
newWin.document.open();
newWin.document.title = "Readings on PageLinks";
newWin.document.write('<html><head><title>'+newWin.document.title+'</title></head><body onload="window.print()">'+element.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){ newWin.close(); },10);