Javascript 使用jQuery printElement插件时出错
您能看一下并告诉我为什么在使用jQuery printElement插件打印Javascript 使用jQuery printElement插件时出错,javascript,jquery,Javascript,Jquery,您能看一下并告诉我为什么在使用jQuery printElement插件打印.table时出现以下错误吗 错误 代码: 谢谢问题出现在您的jQuery版本(2.x edge)中 打印脚本使用: if ($.browser.opera || (/chrome/.test(navigator.userAgent.toLowerCase()))) mainOptions["printMode"] = 'popup'; 因此,您将jQuery版本更改为旧版本,该版本仍然使用$.browser支
.table
时出现以下错误吗
错误
代码:
谢谢问题出现在您的jQuery版本(2.x edge)中 打印脚本使用:
if ($.browser.opera || (/chrome/.test(navigator.userAgent.toLowerCase())))
mainOptions["printMode"] = 'popup';
因此,您将jQuery版本更改为旧版本,该版本仍然使用$.browser
支持。
当有条件地针对用户代理字符串编程时,x-browser和x-device支持不能很好地工作,这一点后来被阻止
整个想法的改变始于jQuery 1.8版。现在,建议您使用支持检测,无论您在哪个浏览器/设备上。您使用的插件将要求您导入jQuery migrate插件。它希望
$.browser
存在,但在库的较新版本中它不存在。转到-您正在使用的库的版本似乎已经过时。谢谢Tim,我想问一个简单的问题?是否有任何选项可以在没有“弹出”窗口的情况下打印元素?我相信您可以使您的弹出窗口在print.css中可见?不确定。也许看看
$(function () {
$('button[type="submit"]').click(function () {
$(this).closest('.panel').find('table').printElement();
});
});
if ($.browser.opera || (/chrome/.test(navigator.userAgent.toLowerCase())))
mainOptions["printMode"] = 'popup';