Home > Web Front-end > JS Tutorial > The CSS centering code of JS printing interface is suitable for all browsers_javascript skills

The CSS centering code of JS printing interface is suitable for all browsers_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:55:14
Original
1677 people have browsed it
Copy code The code is as follows:

function preview(oper) {
if (oper < 10 ) {
bdhtml = window.document.body.innerHTML;//Get the html code of the current page
sprnstr = "";//Set the printing start area
eprnstr = "";//Set the print end area
prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) 18); //Start the code Get html backward

prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//Get html forward from the end code
window.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%;
}










Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template