代码示例:(标识:jsref_window_print)
<!DOCTYPE html>
<html>
<head>
<script>
function printPage() {
  window.print();
}
</script>
</head>
<body>

<input type="button" value="打印此页" onclick="printPage()" />

</body>
</html>
运行结果: