douyi9787 2017-07-25 00:33
浏览 105
已采纳

在.php文件中添加javascript签名板

I have a .php file that once a transaction is approved, I want it to show the signature pad but how will I implement it into my php code. The code below is a part of the .php file and I need to get https://github.com/szimek/signature_pad this signature pad to show but it is in JavaScript.

 if($tran->result == "Approved"){

}

d

if($tran->result == "Approved"){
?>



<?
echo '<canvas id="signature-pad" class="signature-pad" width=400 
height=200></canvas>
    <div>
<button id="save">Save</button>

<button id="clear">Clear</button>
</div>'

?>
 <script type="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/signature_pad/1.5.3/signature_pad.min.js"></script> <script> var signaturePad = new 
 SignaturePad(document.getElementById('signature-pad'), {
  backgroundColor: 'rgba(255, 255, 255, 0)',
  penColor: 'rgb(0, 0, 0)'
});
var saveButton = document.getElementById('save');
var cancelButton = document.getElementById('clear');

saveButton.addEventListener('click', function (event) {
  var data = signaturePad.toDataURL('image/png');

// Send data to server instead...
  window.open(data);
});

cancelButton.addEventListener('click', function (event) {
  signaturePad.clear();
});    </script> </script><script src="touchpadjs.js"></script>
  • 写回答

2条回答 默认 最新

  • douzhanshen0657 2017-07-26 03:05
    关注

    Found out what was wrong, the js file was not being accessed by the html and css code so i just added all the code into the php function as with for javascript and for css and it all started working.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划