js 列印頁面且自定義頁首頁尾

2022-08-23 08:48:11 字數 2104 閱讀 2442

解決:1,更換jquery

2,或者引入 jquery-migrate.min.js

<

input

type

="button"

id="printtest"

value="列印" onclick

="printtest()"

>

<

div

id="printcontent"

>

<

div>test

div>

<

div>test

div>

<

div>test

div>

div>

實際上jqprint.js,還是呼叫window.print()

2,自定義頁首頁尾

<

input

type

="button"

id="printtest"

value

="列印"

onclick

="printtest()"

>

<

div

id="printcontent"

>

<

div

class

='header-test'

>頁首

div>

<

div

class

='footer-test'

>頁尾

div>

<

table

>

<

thead

>

<

tr><

td><

div

class

='header'

>

div><

td>

tr>

thead

>

<

tbody

>

<

tr><

td>

<

div>test

div>

<

div>test

div>

<

div>test

div>

<

td>

tr>

tbody

>

<

tfoot

>

<

tr><

td><

div

class

='footer'

>

div><

td>

tr>

tfoot

>

table

>

div>

在寫css之前先了解一下面的知識:

css3 **查詢 @media

@media 查詢:可以針對不同**型別定義不同的樣式

**型別:

all:用於所有裝置

print:用於印表機和列印預覽

screen:用於螢幕顯示

...這裡就簡單介紹上面幾個。

<

style

>

@media print

.header-test

.footer-test

thead

tfoot

-------分界線(上面就可以實現每頁上都有頁首頁尾了)-------------

#printtest

.header-test,.footer-test 

}# 網頁上隱藏自定義的頁首頁尾,列印時才顯示

@media screen

.header-test,.footer-test

}

style

>

注:不過這種方式,只適合谷歌瀏覽器,測試過搜狗、ie都有些問題。

Latex之自定義頁首頁尾

定義頁首頁尾要用到 pagestyle其中latex內建了四種 empty 沒有頁首和頁尾 plain 沒有頁首,頁尾中部放置頁碼。headings 沒有頁尾,頁首包含章節的標題和頁碼。myheadings 沒有頁尾,頁首頁碼和使用者所定義的資訊。article 預設使用 plain 格式,而 bo...

利用js去除列印時的頁首頁尾

code var hkey root,hkey path,hkey key hkey root hkey current user hkey path software microsoft internet explorer pagesetup 設定網頁列印的頁首頁尾為空 function page...

自定義列印

1 第一種方法 page language c autoeventwireup true codefile testprint.aspx.cs inherits testprint 第二種方法 page language c autoeventwireup true codefile print.a...