打印网页后刷新页面 [英] Page refresh after printing the webpage

查看:325
本文介绍了打印网页后刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/JavaScript">
     
     window.print()
     window.close()

   </script>

 <input type="button" value="Print"  önclick="this.style.visibility='hidden';window.print();" />



我正在使用此代码网页进行打印,但在打印后我想显示旧页面,它将包含按钮,即打印,保存和内容

如何使用Java脚本代码显示


谢谢与问候
venky



I am using this code webpage was printing but after printing i want to display old page it will contains buttons i.e print, save and Content

how it is displayed using java script code


Thanks &Regards
venky

推荐答案

您是不是要让打印"按钮(隐藏在其事件处理程序中)再次出现?如果是这样,则需要为其指定一个ID,然后执行以下操作:
Do you just mean you want the ''print'' button (that you hid in its event handler) to come back again? If so, you need to give it an id, and then do:
document.getElementById("print_button").style.visibility = '''';



(注意:我通常改用.style.display,但我认为没什么区别.)

或者,如果您希望它在调用window.print()之后立即返回,则可以在事件处理程序中内联它:



(Note: I usually use .style.display instead, but I think that makes little difference.)

Or if you want it to come back immediately after window.print() is called you can inline it in the event handler:

<input type="button" value="Print"  önclick="this.style.visibility=''hidden'';window.print();this.style.visibility=''''" />



但是,这根本没有意义,因为如果您根本不提供按钮,则用户可以使用浏览器的打印"按钮!

您还可以使用CSS来显示/隐藏要打印的元素,例如,参见本文 [ ^ ].



However, this is all rather pointless since if you didn''t provide the button at all, the user could just use the browser''s Print button!

You can also use CSS to show/hide elements for printing, see for example this article[^].


尝试此

http://www.mediacollege.com/internet/javascript/page/reload.html [ ^ ]
try this

http://www.mediacollege.com/internet/javascript/page/reload.html[^]


这篇关于打印网页后刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆