|
|
|
Print Preview เขียน code อย่างไรครับที่เวลา Print Preview จะแสดงเมนู As laid out on screen , Only |
|
|
|
|
|
|
|
Code (JavaScript)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<table width="533" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
<tr>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
<td>www.ThaiCreate.Com</td>
</tr>
</table>
<br>
<script language="javascript">
function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}
</script>
<input name="btnPrint" type="button" id="btnPrint" value="Print" onClick="JavaScript:this.style.display='none';printpr();">
</body>
</html>
Ref : JavaScript Auto Print Preview
|
|
|
|
|
Date :
2009-06-03 18:10:03 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|