Home >Web Front-end >JS Tutorial >Javascript script to print part of the web page_javascript skills

Javascript script to print part of the web page_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:58:461371browse

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
Statement:
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