function preview(oper) {
if (oper bdhtml = window.document.body.innerHTML;//取得目前頁面的html程式碼
sprnstr = "";//設定列印開始區域
eprnstr = "";//設定列印結束區域
prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) 18); //從開始程式碼往後取html
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//從結束程式碼向前取html
window.document.body.innerHTML = prnhtml;
window.print(document.body.innerHTML = prnhtml;
window.print( );
window.document.body.innerHTML = bdhtml;
} else {
window.print();
}
}
#outer {
display:table;
height:400px;
#position:relative;
overflow:hidden;
}
#middle {
display:table-cell;
vertical- align:middle;
#position:absolute;
#top:50%;
}
#inner {
#position:relative;
#top:-50%;
}