单选按钮选择未显示在 window.print() 中

问题描述 投票:0回答:1

单选按钮选择未出现在 window.print() 中的问题

HTML:

                <p>This is question # one, Please Select yes or no below</p>
                <input type="radio" name="Q1">Yes <input type="radio" name="Q1">No

                <p>This is question # two, Please Select yes or no below</p>
                <input type="radio" name="Q2">Yes <input type="radio" name="Q2">No

                <p>This is question # three, Please Select yes or no below</p>
                <input type="radio" name="Q3">Yes <input type="radio" name="Q3">No

                <p>This is question # four, Please Select yes or no below</p>
                <input type="radio" name="Q4">Yes <input type="radio" name="Q4">No<br><br>

                <button type="button" onclick="readySignature()">Click to Sign</button>
                <button type="button" onclick="finishSigning()">Finish Signing</button>
                <button type="button" onclick="(printNow())">Print Contract</button>

JS:

function readySignature(){
        canvas = document.getElementById("testSig");
        signaturepad = new SignaturePad(canvas);
        console.log("This Works");

}

function finishSigning(){

    var pngdata  = signaturepad.toDataURL();
    var sigArea = document.getElementById("sigArea");
    var image = document.createElement("img");
    image.src = pngdata;
    sigArea.innerHTML = "";
    sigArea.appendChild(image);

}

function printNow(){
    var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    mywindow.document.write('<html><head><title>' + document.title  + '</title>');
    mywindow.document.write('</head><body >');
    mywindow.document.write('<h1>' + document.title  + '</h1>');
    mywindow.document.write(document.getElementById("contract").innerHTML);
    mywindow.document.write('</body></html>');

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/

    mywindow.print();
    mywindow.close();

    return true;
}

打印时和在预览窗口中,不会显示单选按钮选项。我检查了 chrome 中是否启用了背景图形,并且我添加了

.ui-state-active {
        -webkit-print-color-adjust: exact;
}
.ui-label-active {
        font-weight: bold !important;
        font-size: 20px !important;
        -webkit-print-color-adjust: exact;
}

到我的CSS。

尽管如此,我还是无法让单选按钮选择出现在打印中。

javascript printing radio-button
1个回答
0
投票
input[checked] {
    -webkit-print-color-adjust: exact;
}
© www.soinside.com 2019 - 2024. All rights reserved.