考虑以下代码示例:
<!DOCTYPE html>
<html>
<head>
<title>HTML5-Template</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
.print_this{
display: none;
}
@media print {
.print_this {
display: block;
width: 1024px;
height: 768px;
}
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(function () {
var el = document.getElementById("report");
el.focus();
el.print();
}, 1500);
});
</script>
</head>
<body>
<div id="Container">
<object class="print_this" id="report" name="report" type="application/pdf" data="Certificate.pdf"></object>
</div>
</body>
</html>
我想在窗口中对用户隐藏对象,但在显示打印对话框时只打印标签的内容......这可能吗?
注意:代码来自互联网上的其他地方,但是我觉得这非常不基于标准?