找到此代码以打印我修改的JavaScript元素。尽管我添加了document.title
和<title></title>
标签,但在常规文本编辑器中打开的窗口显示为untitled
。JavaScript打印的窗口标题
这通常是保存文本之前的情况。无论如何,有没有办法显示标题?
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);
为什么不?。newWin.document.write(”
这并没有有所作为我有这样的第一 – user823527
必须的有一些不同的东西或其他地方犯了一个错误,至少对于我的电脑来说是这样的 – Huangism