-->

input 打印并记录打印次数

2019-09-12 08:37发布

问题:

使用JS打印页面内容,我想记录打印次数,并通过后台写入数据库;
但是这里  input 的  onclick事件 =document.all.WebBrowser.ExecWB(6,1)
怎样记录 input 按钮按下   就转入后台代码执行方法


<object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" width="0"> </object>
                    
                     <asp:Panel ID="panel1" runat="server" Width="634px"><span lang="zh-cn" 
                             style="font-size: small">
                         <input onclick="document.all.WebBrowser.ExecWB(6,1)" type="button" value="直接打印" />
                             <input onclick="document.all.WebBrowser.ExecWB(8,1)" type="button" value="页面设置" />
                             <input  onclick="document.all.WebBrowser.ExecWB(7,1)" type="button" value="打印预览" />

回答1:

你得写个DoPrint方法,类似

doPrint(id){
    document.all.WebBrowser.ExecWB(id,1);
    LogtoDatabase;
}


回答2:

doPrint(id){
    document.all.WebBrowser.ExecWB(id,1);
    LogtoDatabase;
}