窗口执行打印命令,完成打印后,窗口自动关闭,用JS可以怎样写?请教~~~基本代码如下:
Response.Write(" <script>window.print() </script>");
Response.Write(" <script>window.print() </script>");
解决方案 »
- 求助 c# 怎样用 MySQLDriverCS操作mysql进行update、insert、deleted等操作
- OnPaint()函数调用base.OnPaint()出现栈溢出
- messagebox.show的问题
- C#调用dll函数,IntPtr如何作参数传递
- 画出来的图形 比如矩形什么的? 怎么能让他响应单击或者双击等命令》??
- 怎样把以下VB代码来写成C#
- 在删除GAC目录中的程序集时报"Assembly'...'could not be uninstalled because it is required by other applications."
- C#中,关于TCPIP流networkStream.Write的写入和networkStream.Read的读的同步问题
- 我要在business service/logic 层调用dataset
- vista下如何为iis装fontpage服务器扩展呢?
- 谁能给解释下Focus意思?
- c#中调用DLL(C++)以显示多行字符串的问题!
function printTure()
{
window.print();
window.opener=null;
window.open('','_self');
window.close();
}
</script>
把这段代码放的html里面
后台调用js执行!
这样代码看着更加顺畅,单纯的close()在Ie7下面如果是父窗体会提示一个是否关闭的的对话框,我的方法解决了这个问题,Ie6下使用一样没有问题!
具体调用方法为
ClientScript.RegisterStartupScript(GetType(), "_msg", "<script>printTure();<script>");
Response.Write(" <script>window.print();setTimeout(window.close(), 5000); </script>");
是以毫秒計算得~~所以5 毫秒和沒有 差不多~~
Response.Write(" <script>window.print();setTimeout('window.close()', 5000); </script>");