Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 另存为文档并打印html页面Onclick事件_Javascript_Php_Jquery_Html - Fatal编程技术网

Javascript 另存为文档并打印html页面Onclick事件

Javascript 另存为文档并打印html页面Onclick事件,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我正在尝试创建一个onclick事件,通过该事件,当前html页面将保存为文档并打印它们 <html> <body> <div class="reportformat"> <div class="format1"> <table> <tr> <td><b> Blood Values </b><

我正在尝试创建一个onclick事件,通过该事件,当前html页面将保存为文档并打印它们

<html>
     <body>
       <div class="reportformat">
       <div class="format1">
        <table>
          <tr>
          <td><b> Blood Values </b></td>
          <td><b>Normal Values</b></td>
          </tr>
          <tr>
          <td>Haemoglobin :</td><td><?php echo $_POST["hb"]; ?>G%</td>                               
          <td> [ M:13.5 -17.0G% ---- F:12.5-16.0G% ]</td>           
           </tr>
            </table>    
            <div id="b1"><center>SAVE & PRINT</center></div>
          </div>
        </div>
        </body>
    </html>

 Can anyone please help me saving the current html page as word document using jquery or javascript.

血液价值
正常值
血红蛋白:G%
[M:13.5-17.0G%----F:12.5-16.0G%]
保存和打印
有人能帮我用jquery或javascript将当前html页面保存为word文档吗。

如果您想使用纯javascript,可以使用jspdf保存文档 您可以使用
窗口打印文档。打印

请参考下面的链接


您需要获取该html,通过ajax发送,然后执行到php的转换,就可以了。我建议使用Pandoc()将exec/shell\u exec转换为php()。只是一个提示:您不应该使用类似
$\u POST[“hb”]
的东西,因为它根本不安全!