Home > Article > Web Front-end > Lainiao introduces the window.print() method_javascript skills
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.