自动打印本页内容的html代码怎么写??内详

来源:百度知道 编辑:UC知道 时间:2024/05/10 05:31:15
就是点一个连接,然后弹出一个页面,然后5秒后自动从打印机输出弹出页的内容,怎么设置?

请说具体点,谢谢!

楼上所提供的方法是普通的网页打印功能 window.print()。

提问者所要的效果就像新浪新闻中点击打印的功能。

<div id=context>
                     文章标题
----------------------------------------------------
文章内容文章内容文章内容文章内容文章内容文章内容文章
内容文章内容文章内容文章内容文章内容文章内容
</div>

<a href="javascript:doPrint()">打印</a>

<script>
function doPrint(){
        css="<style>"
        +"body{font-family:宋体}"
        +"td{font-size:12px}"
        +"</style>";

        str += css;
        str += '<title>打印标题:'+do