메뉴 건너뛰기

조회 수 32693 추천 수 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
번호 제목 날짜 조회 수
187 HTML 화면을 PDF로 출력 file 2019.01.08 5222
186 == / === / != / !== 차이 2018.11.07 1443
185 오늘 날짜 구하기 2018.11.07 1416
184 jQuery 엘리먼트 선택 2018.10.27 1732
183 자바스크립트 urlencode(), urldecode(), rawurlencode(), rawurldecode() 2018.10.27 1913
182 자바스크립트 배열 중복값 다루기 2018.10.27 3898
181 JavaScript 출생년도에 따른 나이 계산 자바스크립트 2018.09.28 3252
180 엔터키 / enter key submit form 2018.09.28 1528
179 팝업창 차단 "허용 메시지" 2018.09.28 1738
178 테이블에서 해당 열의 인덱스 값 얻는 방법 2018.08.29 2794
177 key pressing 누르거나 클릭중인 이벤트 예제 2018.08.29 1622
176 유용한 스크립트 모음 2018.07.24 2294
175 cross site scripting을 막기위한...javascript 2018.07.24 1596
174 다음 우편번호(주소) api 예시 file 2018.07.04 4907
173 스마트에디터(SmartEditor)에서 textarea 유효성 체크하기 2018.07.04 3993
172 반복문 사용할때 태그 식별하기 data-item 2018.07.04 1849
171 SelectBox에서 선택된 항목의 텍스트, 값 가져오기 선택 옵션 넣기. 2018.07.04 4014
170 체크박스(CheckBox) 전체 선택, 전체 해제 checked file 2018.07.04 2919
169 스마트 에디터 (네이버 에디터) 에디터 내에서 이미지 크기 줄이기.(리사이징) file 2018.07.04 2715
168 Javascript selectbox selected 컨트롤 file 2018.06.21 10058
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved