1. Implement on the server side
1. This is written in the. CS file on this page.
CopyCode The Code is as follows: if (resultint> 0)
{
// Clear the verification code, display the execution result, and forward it to the new address
Session ["yanzhengma"] = "";
String caocode = "If (confirm ('submitted successfully, printed? ')" +
"{" +
"Window. Location. href = 'printtkz. aspx? Type = BF & bmid = "+ _ flowidvalue +" & bufeitime = "+ _ jftimevalue +" & palje = "+ _ shouxianvalue +" & goto = bufeilist. aspx '; "+
"}" +
"Else" +
"{" +
"Window. Location. href = 'bufeilist. aspx ';" +
"}";
MessageBox. Alert (page, (object) caocode );
}
2. Print printtkz. aspx on the page you want.
<Body onload = "VBScript: window. Print ()">
You can.
2. Implementation on the clientCopy codeThe Code is as follows: <script language = "JavaScript">
Function doprint (){
Bdhtml###doc ument. Body. innerhtml;
Sprnstr = "<! -- Startprint --> ";
Eprnstr = "<! -- Endprint --> ";
Prnhtml = bdhtml. substr (bdhtml. indexof (sprnstr) + 17 );
Prnhtml = prnhtml. substring (0, prnhtml. indexof (eprnstr ));
Too many Doc ument. Body. innerhtml = prnhtml;
Window. Print ();
}
</SCRIPT>
<! -- Startprint --> place it at the beginning of the print area
<! -- Endprint --> Print the end of a place
<A href = "javascript:;" onclick = "doprint ()"> Print </a>