Home >Web Front-end >JS Tutorial >Lainiao introduces the window.print() method_javascript skills

Lainiao introduces the window.print() method_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:21:241439browse

Definition and usage of print() method:

This method can generate a print settings interface, which is the same as the interface generated by right-clicking the window and then clicking the print option.

Grammar structure:

window.print()

Browser support:

1.IE browser supports this attribute.
2.Firefox browser supports this attribute.
3. Opera browser supports this attribute.
4.Chrome browser supports this attribute.

Code example:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>window.print()函数</title>
<script type="text/javascript">
window.print();
</script>
</head>
<body>
</body>
</html>

Execution of the above code can generate a print settings interface, which can print the current page.

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