gpt4 book ai didi

javascript - window.print() 在页面打印后从复选框中删除复选标记

转载 作者:可可西里 更新时间:2023-11-01 13:42:23 25 4
gpt4 key购买 nike

我使用 icheck 单选按钮和复选框创建了一个 list 。我还有一个按钮可以打印 list 。

<style>
@media print {
#printpage {
display: none;
}
#submit {
display: none;
}
.noprint {
display: none;
}
input[type=checkbox], input[type=radio] {
opacity: 1 !important;
}
}
</style>

<div class="row">
<div class="col-lg-12">
<div class="form-group i-checks">
<input type="checkbox" name="poa" id="poa" />
<strong><a href="forms/poa.cfm" target="_blank">Power of Attorney - if applicable (click here to print)</a></strong>
</div>
</div>
</div>

<button class="btn-u btn-u-orange" onclick="printChecklist()" name="printpage" id="printpage" ><i class="icon-printer"></i> Print Checklist</button>

<script>
function printChecklist() {
window.print();
}
</script>

The issue I am running into is once I select print all the check boxes then becoming unchecked again as if the page has refreshed or something.

有没有一种方法可以让我的按钮打印页面但不取消选中我所有的复选框,让屏幕保持用户点击打印按钮时离开屏幕的方式?

最佳答案

以防其他人遇到我遇到的这个问题。我最终发现我删除了脚本函数并将按钮的 onclick 更改为 onclick="window.print(); return false;"

关于javascript - window.print() 在页面打印后从复选框中删除复选标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53655135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com