如何在 PrintThis 插件页脚中使用输入框值
How to use input box values in PrintThis plugins footer
$(document).on("click", "#btnPrin9t", function(e) {
// e.preventDefault();
// e.stopPropagation();
$("#table, #txtW, #txtAt").printThis({
debug: false, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS: "", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 0, // variable print delay; depending on complexity a higher value may be necessary
base: true,
header: "",
footer: "<br>Total in Words:'"
$('#txtWord').val()
"'", // prefix to html
formValues: true // preserve input/form values
});
});
我想使用页脚打印输入框值。我可以使用打印点击,如第一行所示,但需要进行一些调整。我想在页脚中使用任何人都可以帮助。
为了连接 javascript 中的字符串,我们使用 +
所以不是这个:
"<br>Total in Words:'"$('#txtWord').val()"'"
尝试:
"<br>Total in Words:'"+$('#txtWord').val()+"'"
所以你的代码将是这样的:
$(document).on("click", "#btnPrin9t", function (e) {
// e.preventDefault();
// e.stopPropagation();
$("#table, #txtW, #txtAt").printThis({
debug: false, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS: "", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 0, // variable print delay; depending on complexity a higher value may be necessary
base: true,
header: "",
footer: "<br>Total in Words:'"+$('#txtWord').val()+"'", // prefix to html
formValues: true // preserve input/form values
});
});
$(document).on("click", "#btnPrin9t", function(e) {
// e.preventDefault();
// e.stopPropagation();
$("#table, #txtW, #txtAt").printThis({
debug: false, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS: "", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 0, // variable print delay; depending on complexity a higher value may be necessary
base: true,
header: "",
footer: "<br>Total in Words:'"
$('#txtWord').val()
"'", // prefix to html
formValues: true // preserve input/form values
});
});
我想使用页脚打印输入框值。我可以使用打印点击,如第一行所示,但需要进行一些调整。我想在页脚中使用任何人都可以帮助。
为了连接 javascript 中的字符串,我们使用 +
所以不是这个:
"<br>Total in Words:'"$('#txtWord').val()"'"
尝试:
"<br>Total in Words:'"+$('#txtWord').val()+"'"
所以你的代码将是这样的:
$(document).on("click", "#btnPrin9t", function (e) {
// e.preventDefault();
// e.stopPropagation();
$("#table, #txtW, #txtAt").printThis({
debug: false, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS: "", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 0, // variable print delay; depending on complexity a higher value may be necessary
base: true,
header: "",
footer: "<br>Total in Words:'"+$('#txtWord').val()+"'", // prefix to html
formValues: true // preserve input/form values
});
});