分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

js ScripX插件打印

发布时间:2023-09-06 01:28责任编辑:胡小海关键词:js
1,ScriptX插件初次使用都要先下载安装,压缩包直接放在项目里庵后运行,打开页面根据提示安装就可以了;


2,在**head中引入**

  @media   screen{.onlyPrint{display:none}}     @media   print{.onlyShow{display:none}   .onlyPrint{page-break-before:always}}

然后剩下的js操作就可以了;


3,

function printsetup() {        // 打印页面设置         factory.printing.PageSetup();    }    function doPrint() {    if (confirm('确定打印吗?')) {        document.all.factory.printing.header = ""; //页眉        document.all.factory.printing.footer = ""; //页脚        //设置边距        document.all.factory.printing.leftMargin = 19.05;//left        document.all.factory.printing.topMargin = 19.05;//top        document.all.factory.printing.rightMargin = 19.05;//right        document.all.factory.printing.bottomMargin = 19.05;//bottom        document.all.factory.printing.portrait = false; //横向打印        document.all.factory.printing.Print(false); //只打印当前frame,不管是否隐藏        }    }<center class=aaa><input onclick=javascript:printsetup(); type=button value=打印页面设置 name=button_setup /> <input onclick=javascript:doPrint(); type=button value=打印 name=button_print /> </center>



根据自己实际情况设置初始参数,如需保存更改的打印设置的参数,可以考虑使用JavaScript设置cookie进行操作。



js ScripX插件打印

原文地址:http://blog.51cto.com/10556290/2046403

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved