【问题标题】:print html table without a prompt a preview window在没有提示的情况下打印 html 表格预览窗口
【发布时间】:2012-07-23 10:08:53
【问题描述】:

我将使用按钮和 onclick 功能打印一个 html 表格。 当我尝试这样做时,它总是提示我一个窗口,从那里我必须再次按下一个按钮调用打印。然后只有文档要打印。

所以我想要的是通过单击一个按钮打印该表格并且没有任何打印预览提示,是否可以这样做?如何?

我正在使用此代码打印表格。

function printlayout() {
     var data = '<input type="button" value="Print this page" onClick="window.print()">';           
       var DocumentContainer = document.getElementById('printlayout');
var WindowObject = window.open('', "TrackHistoryData", 
                              "width=740,height=325,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");           
 WindowObject.document.writeln(DocumentContainer.innerHTML);
        WindowObject.document.close();
        WindowObject.focus();
        WindowObject.print();
        WindowObject.close();
 }

我知道这里有成千上万个与此类似的问题,但没有什么能帮助我解决我的问题。我主要专注于谷歌 chrome 浏览器来运行我的应用程序。

【问题讨论】:

    标签: php javascript jquery html ajax


    【解决方案1】:

    不,很遗憾,这是不可能的,该功能由浏览器控制,您无法对其进行操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多