메뉴 건너뛰기

조회 수 32800 추천 수 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 input 빈칸 체크 2014.03.01 6273
186 해상도에 따라 배경 바꾸기 2014.03.01 6086
185 입력된 폼의 내용 똑같이 복사 file 2014.03.01 6898
184 select 당일 날짜 출력 file 2014.03.01 5805
183 입력된 글씨수 제어 file 2014.03.01 6704
182 따라다니는 배너 2014.03.17 6272
181 이미지클릭시 옆에 큰이미지나오기 2014.03.17 5521
180 특정부위 마우스 오버시 설명을 보여주는 소스 2014.03.17 8703
179 이미지 마우스 드래그로 스크롤을 움직이는 소스 2014.03.17 9364
178 자바스크립트 영문입력, 숫자만입력, 한글만 입력, 붙여넣기 방지 2015.02.02 10186
177 페이지 로드 할때 컨트롤에 포커스 주기 2015.02.03 8503
176 마우스로 이미지크기 조절(자바스크립트) 2015.02.03 6542
175 문자열 바꾸기 2015.02.03 5731
174 라디오 바스 체크 유무 확인 2015.02.03 6355
173 버튼 삭제 2015.02.03 5954
172 양력-음력 2015.02.03 7708
171 달력 2015.02.03 6686
170 5초후 자동으로 창닫기 2015.02.03 9048
169 'focus', 엔터 누르고 이동하자! file 2015.02.03 12867
168 유효성 검사, 모든 폼에 값이 입력되도록 해보자! file 2015.02.03 6126
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved