메뉴 건너뛰기

조회 수 32317 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
/*  SAVING, PRINTING AND PRINT PREVIEW 
   USAGE:
     <input type=button value="print preview" onclick="window.ieExecWB(7);">
     <input type=button value="page setup" onclick="window.ieExecWB(8);">
     <input type=button value="print page w Prompt" onclick="window.ieExecWB(6);">
     <input type=button value="print page w/o Prompt" onclick="window.ieExecWB(6, -1);">
     <input type=button value="Save As" onclick="saveAsMe('ww.txt');">
     <input type=button value="Save Copy" onclick="window.ieExecWB(5);"> 
*/

<script language="javascript">

// ====================================================================
// Original post: Unkown person - I lost my notes on who did this first
//                Unkown source
// Modified by:   Walter Torres <walter@torres.ws> [www.torres.ws]
//                2001/04/29
//                I found the secret to remove the prompt!
//                Original post did not have this gem to it.
//
// This accesses a built-in Windows command that can perform Magic!
// And yes, this is a Windows ONLY solution.
// In fact, it only works in IE. :(
//
// This still doesn't work with Frames!  :(
//
//          INPUT: intOLEcmd   = integer between 1 and 37, only a few 
are of use
//                 intOLEparam = parameter integer for function - 
optional
//         OUTPUT: none
//   DEPENDANCIES: none
//
//           NOTE: intOLEparam is not optional in the Object call,
//                 I just made it optional here to make life easier.
//                 All command values use '1' execept print, thus my 
reasoning.
//
//        EXAMPLE: // This prints given window/frame WITHOUT prompt!
//                 objWinName.ieExecWB(6, -1)
//
//                 // This prints given window/frame WITH prompt!
//                 objWinName.ieExecWB(6)

//                // This will display the Print Preview window
//                 objWinName.ieExecWB(7)
//
//         VALUES: intOLEcmd has these possible values
//                 OLECMDID_OPEN         = 1
//                 OLECMDID_NEW          = 2    warning, this kills IE windows!
//                 OLECMDID_SAVE         = 3
//                 OLECMDID_SAVEAS       = 4
// OLECMDID_SAVECOPYAS = 5 note: does nothing in IE
//                 OLECMDID_PRINT        = 6    note: give '-1' as param - no prompt!
//                 OLECMDID_PRINTPREVIEW = 7
//                 OLECMDID_PAGESETUP    = 8
//                          Others have no use in IE

function ieExecWB( intOLEcmd, intOLEparam )
{
// Create OLE Object
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

// Place Object on page
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);

// if intOLEparam is not defined, set it
if ( ( ! intOLEparam ) || ( intOLEparam < -1 )  || ( 
intOLEparam > 1 ) )
intOLEparam = 1;

// Execute Object
WebBrowser1.ExecWB( intOLEcmd, intOLEparam );

// Destroy Object
WebBrowser1.outerHTML = "";
}

</script>

List of Articles
번호 제목 날짜 조회 수
247 유효한 링크인지 확인하는 JAVASCRIPT 2019.01.16 111902
246 [jQuery] 상위부터 차례로 지역 선택하기 2014.03.01 45959
245 Javascript - 이미지 미리보기 회전되어 나옴(EXIF) file 2021.03.09 36272
» javascript 인쇄 미리보기, 출력, 페이지 설정 등 2014.03.01 32317
243 Checkbox : 체크박스 체크여부 확인 file 2015.06.19 19010
242 날짜 및 시간 입력 구현하기, Bootstrap DateTimePicker file 2017.04.06 16530
241 공백 검사 함수 2015.06.19 14575
240 선택(CheckBox) 된 Row 삭제 - 화면에서 추가된 Row 2015.04.28 13536
239 'focus', 엔터 누르고 이동하자! file 2015.02.03 12857
238 라디오버튼 선택 체크여부 radio checked 2014.03.01 12669
237 셀렉트(select) change Ajax 이벤트 2016.12.23 12572
236 input type file multiple list (파일 업로드 리스트 확인) file 2016.11.17 12432
235 간단한 동적 SELECT 박스 구현하기 2016.10.06 12367
234 GET방식으로 전송시 특수문자함께 전송하는 방법 2016.12.22 12338
233 텍스트박스(input type = "text") 숫자 증가, 감소 시키기 - 쇼핑몰 주문 수량 file 2015.06.19 12281
232 창 크기 최대화 시키기 file 2015.06.19 12217
231 [jQuery] 실시간 검색어 순위 순서대로 보여주기 2014.03.01 12017
230 jquery 메뉴 - 아래로 한번에 전체가 펼처짐 file 2015.04.06 11698
229 'Array', 배열 및 다차원 배열 선언에 대해 알아보자! 2015.02.03 11110
228 랜덤 배너 노출 스크립트 2019.04.29 11031
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved