如何打印没有标题的页面?

时间:2017-11-04 19:02:04

标签: javascript html

我试着用下面的代码打印我的页面,但实际上导航栏包含在要打印的文件中我只想知道没有标题或导航栏的热门打印页面。

<script language="JavaScript" type="text/javascript">
            //<![CDATA[
            if (window.print) {
                document
                        .write('<form> '
                                + '<input type=button name=print class="btn btn-info" value="Print" '
                                + 'onClick="javascript:window.print()"> <\/form>');
            }
            // End -->
            //]]>
        </script>

1 个答案:

答案 0 :(得分:1)

以下内容将在打印文档时隐藏.navigation

@media print {
   .navigation {
      visibility: hidden;
   }
}

您还可以尝试opacity: 0display: none

相关问题