Home > Web Front-end > JS Tutorial > body text

Javascript script to print part of the web page_javascript skills

WBOY
Release: 2016-05-16 18:58:46
Original
1335 people have browsed it

Normal printing is to use window.print(); to print the entire page directly, but if you need to print part of the content defined in the web page, you can use the following method:
1. Add JavaScript to the code header of the page :
JavaScript code

Copy code The code is as follows:



2. Add and flags.
That is, append it to the html corresponding to the text that the user needs to print and save. At the same time, if a thief program is used to obtain remote data and needs to be printed, the data can be placed in the definition tag.
3. The intercepted content part has been completed. Now add a "print" link:
Print
Related labels:
source:php.cn
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