自动下载定性PDF

时间:2018-08-02 15:50:48

标签: qualtrics

我正在使用定语为硕士论文进行调查。出于道德原因,我们需要每位参与者自动下载其同意书,包括他们曾经勾选或未勾选的两个方框。我对编码非常陌生,而且对质量的支持没有提供任何建议,所以我想我会在这里碰碰运气。这是我以前的研究中使用的代码,虽然不确定我是否可以将其用于定性分析……感谢任何想法! (附注:此处包含的PDF是一个示例)

function download(url) {
    var link = document.createElement('a');
    link.href = url;
    link.target = '_blank';
    link.download = '';
    document.getElementsByTagName('body')[0].appendChild(link);
    link.click();
}

var dnl = String.fromCharCode(13) + String.fromCharCode(13);
window.alert('A copy of this file will now be downloaded to your computer. '+dnl+'If the download does not start automatically, please save it manually by clicking the right mouse button, selecting ‘Print’, and then ‘Save as PDF’. '+dnl+'Please click ok to continue.');

if (document.getElementsByName('v_673')[0].checked && !document.getElementsByName('v_680')[0].checked) {
    download('http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf')
} else if (!document.getElementsByName('v_673')[0].checked && document.getElementsByName('v_680')[0].checked) {
    download('http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf')
} else if (document.getElementsByName('v_673')[0].checked && document.getElementsByName('v_680')[0].checked) {
    download('http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf')
} else {
    download('http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf')

0 个答案:

没有答案