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

JavaScript 实现打印,打印预览,打印设置_javascript技巧

WBOY
Release: 2016-05-16 16:23:24
Original
2289 people have browsed it

WebBrowser是IE内置的浏览器控件,无需用户下载.

一、WebBrowser控件

二、WebBrowder控件的方法 //打印

WebBrowser1.ExecWB(6,1);

//打印设置

WebBrowser1.ExecWB(8,1);

//打印预览

WebBrowser1.ExecWB(7,1);

关于这个组件还有其他的用法,列举如下:

WebBrowser.ExecWB(1,1) 打开 Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口 Web.ExecWB(4,1)

保存网页 Web.ExecWB(6,1) 打印 Web.ExecWB(7,1) 打印预览 Web.ExecWB(8,1)

打印页面设置 Web.ExecWB(10,1)

查看页面属性 Web.ExecWB(15,1)

好像是撤销,有待确认 Web.ExecWB(17,1)

全选 Web.ExecWB(22,1) 刷新 Web.ExecWB(45,1)

关闭窗体无提示 但是打印是会把整个页面都打印出来的,页面里面有什么东西就打印出来,我们有时候只需要打印数据表格,这时我们就要写一个样式了:

把不想打印的部份隐藏起来: 样式内容:

然后使用样式就可以:

不需要打印的地方

代码如下:

复制代码 代码如下:

 

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!