-1

嗨,我有一个打印脚本来打印页面

$print9 ='<script>
function printpage()
  {
  window.print()
  }
</script>
    </head>
    <body><input type="button" value="Print" onclick="printpage()">

    </body>

    </html></div>
    ';

echo $print9;

它工作得很好,但它也打印硬拷贝的打印按钮,并且不想打印打印按钮我该怎么做我也搜索过,但我无法理解那里的答案。

4

3 回答 3

3

为什么不只是:

<script>window.print()</script>

或者,如果您想打印 onclick 但隐藏按钮:

@media print {
  /* style sheet for print goes here */
  .hide-from-printer{  display:none; }
}

现在,任何具有此类的元素在打印时都将不可见,因此只需将其应用于按钮:

<input class="hide-from-printer" type="button" value="Print" onclick="printpage()">
于 2013-11-06T15:44:28.683 回答
2

使用 CSS 和@media print规则隐藏“打印”媒体的按钮。

于 2013-11-06T15:46:18.313 回答
2

简单的 !

<script>window.print()</script>
于 2014-03-02T18:05:42.700 回答