asp.net 添加打印

<div style="margin-top: auto; text-align: center;" id="buttondiv">
        <object id="wb" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
            name="wb">
        </object>
        <input class="btb" onclick="javascript:printit()" type="button" value="打印" name="button_print" />
        <input class="btb" onclick="javascript:printsetup();" type="button" value="打印页面设置"
            name="button_setup" />
        <input class="btb" onclick="javascript:printpreview();" type="button" value="打印预览"
            name="button_show" />
        <input class="btb" onclick="document.getElementById('buttondiv').style.display='none';"
            type="button" value="隐藏按钮" />
    </div>

 

<script type="text/javascript">
    function printsetup() {
        // 打印页面设置  
        document.getElementById('buttondiv').style.display = "none";
        wb.execwb(8, 1);
        document.getElementById('buttondiv').style.display = "block";
    }

    function printpreview() {
        // 打印页面预览  
        document.getElementById('buttondiv').style.display = "none";
        wb.execwb(7, 1);
        document.getElementById('buttondiv').style.display = "block";
    }

    function printit() {
        if (confirm('确定打印吗?')) {
            document.getElementById('buttondiv').style.display = "none";
            wb.execwb(6, 6)
            document.getElementById('buttondiv').style.display = "block";
        }
    }  
</script>

 

posted @ 2013-04-10 17:44  Uoolo  阅读(244)  评论(0编辑  收藏  举报