메뉴 건너뛰기

조회 수 32788 추천 수 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 엔진, Web API, Task Queue, Event Loop) file 2023.01.20 138
246 Node.js와 npm(+ npx)의 개념 2023.01.20 135
245 바닐라 JS, ECMAScript 개념 file 2023.01.20 109
244 마우스 오른쪽버튼 , 드래그 선택 차단 2023.01.12 118
243 개발자도구 F12키 막기 file 2023.01.12 176
242 패스워드, 확인패스워드가 맞는지 체크 2023.01.12 130
241 문자열 안에 쌍따옴표, 홑따옴표 표시하는 3가지 방법 file 2021.08.20 1800
240 대소문자 변경 (대문자를 소문자로, 소문자를 대문자로) 2021.08.20 261
239 시간 계산하기 (시/분/초/ 더하기, 빼기) 2021.08.20 1714
238 날짜 계산 (Date) 마지막 날짜(말일)/윤달/윤년 처리하기 2021.08.20 1555
237 월의 마지막 날짜 계산하기 2021.08.20 242
236 Date 객체로 원하는 날짜, 시간 표현하기 2021.08.20 223
235 날짜 계산하기 (년/월/일 더하기, 빼기) 2021.08.20 2367
234 3자리 마다 쉼표만 찍어주는 number_format 함수 2021.03.26 225
233 팝업창 맨위로 올라오게 하기 2021.03.26 894
232 폼안에 태그명, 함수명 같을때 오류 2021.03.26 215
231 ajax 사용시 Internal Sever Error 뜨는 경우 2021.03.26 968
230 자주쓰는 것들 2021.03.26 208
229 utf-8일때 alert 한글 깨짐 해결 2021.03.26 3584
228 split, join, replace, replace_all 2021.03.26 214
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved