我正在尝试在由 js 创建的窗口内添加一个打印按钮。但它显示[object Window]
而不是显示链接或按钮。什么是替代解决方案?
jQuery(function($) {
$('a.print').click(function(){
var print_button = '<a href="javascript:window.print();" class="print">Print</a>';
var print_page = window.open('','Print','width=600,scrollbars=yes, height=700');
var html = print_page + '<h2><?php print t("Term & Condition"); ?></h2> <br/>' + 'somethings';
print_page.document.open();
print_page.document.write(html);
print_page.document.close();
return false;
});
});