01.
<script type=
"text/javascript"
>
02.
03.
function
printPreview() {
04.
05.
var
windowWidth=850;
06.
07.
var
windowHeight=550;
08.
09.
var
myleft=(screen.width)?(screen.width-windowWidth)*0.5:100;
10.
11.
var
mytop=(screen.height)?(screen.height-windowHeight)*0.5:100;
12.
13.
var
feature=
'left='
+myleft+
',top='
+
eval
(mytop-50)+
',width='
+windowWidth+
',height='
+windowHeight+
','
;
14.
15.
feature+=
'menubar=yes,status=no,location=no,toolbar=no,scrollbars=yes'
;
16.
17.
window.open(window.location+
'?print_preview=2'
,
'welcome'
,feature);
18.
19.
20.
21.
}
22.
23.
</script>
24.
25.
26.
27.
<button id=
"printPreview"
onclick=
"printPreview()"
>Print Preview</button>