index.html:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<iframe id="frame" src="test.html" frameborder="0"></iframe>
<script type="text/javascript" src="jquery-1.11.2.min.js"></script>
<script>
var iframe = document.getElementById('frame');
iframe.contentWindow.focus();
iframe.contentWindow.print();
</script>
</body>
</html>
test.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>打印网页中iframe内容的测试</h1>
</body>
</html>