PHP/CSS/JS -禁用打印按钮,同时保留文档标题
PHP/CSS/JS - Disable print button while keeping document title
我试图禁用页面上的打印按钮,同时保持文档标题,我在让它工作有一些问题。要么是禁用按钮,没有文档标题要么是文档标题,看看按钮。我有一个或另一个,但不是两个。
这是我的示例代码,有人能看到我做错了什么?我被难住了,已经找了大约一天了,现在试图使它工作。
当然还有更多的页面,但这是与按钮相关的代码。如果您需要更多的页面,请告诉我。
如果有人能看出我在哪里做错了,我想要一个正确方向的指针。
<head>
<?php //-----------disabling the header and footer when printing-----------------------// ?>
<style type="text/css" media="print">
@page
{
size: auto;
margin: 2mm;
}
@media print
{
.no-print;
{
display: none !important;
}
}
</style>
<?php //-----------end disabling the header and footer when printing-------------------// ?>
</head>
<body>
<table>
<tr>
<td>
<b> You are viewing the report preview for: </b> <?php echo $yearmonthd; ?>
</td>
<td width="370px"> </td>
<td>
<input type="button" onClick='window.print();document.title ="<?php echo "Report for - "; echo $team1; echo " - "; echo $yearmonthd; ?>";' class="no-print" value="Print/Save this report"/>
</td>
</tr>
</table>
</body>
这是;在.no-print CSS声明之后,导致它仍然显示按钮。
试题:
<head>
<?php //-----------disabling the header and footer when printing-----------------------// ?>
<style type="text/css" media="print">
@page
{
size: auto;
margin: 2mm;
}
@media print
{
.no-print
{
display: none !important;
}
}
</style>
<?php //-----------end disabling the header and footer when printing-------------------// ?>
</head>
<body>
<table>
<tr>
<td>
<b> You are viewing the report preview for: </b> <?php echo $yearmonthd; ?>
</td>
<td width="370px"> </td>
<td>
<input type="button" onClick="window.print();document.title ='<?php echo "Report for - $team1 - $yearmonthd";?>'" class="no-print" value="Print/Save this report"/>
</td>
</tr>
</table>
</body>
相关文章:
- 通过Javascript检测文档标题的更改
- 单击链接时如何更改文档标题
- 如何通过函数动态更改文档标题
- Sharepoint文档库-使用javascript从文件名到标题
- 文档标题不是文档<标题>
- 杜兰达尔多语言应用程序,页面/模块标题作为可观察的,动态更改文档.标题
- 使用 JavaScript 获取文档标题元
- 使用 javascript 将文档标题更改回去
- 搜索文档并查找所有带有标题的输入
- 用于添加标题的脚本及其对 HTML 文档中所有锚标记的值
- Html更改文档'的标题
- 当标题被另一个脚本更改时,更改文档标题
- 文档标题在ie8中更改哈希
- 如何从子文档更改文档标题
- 如果没有被我更改,请替换文档标题
- 文档.标题返回未定义.这是为什么?
- 文档标题不会停止闪烁
- 使文档标题改变可见的chrome与javascript
- 如何像facebook一样更新文档标题并正确删除它
- PHP/CSS/JS -禁用打印按钮,同时保留文档标题