티스토리 뷰
/**
* PRINT
* target : [{ id : '', type : ''}]
* title
*/
function print(target, title){
let pageContent = '' ;
// CONTENT 생성
target.forEach( function ( obj , index) {
let targetId = obj.id;
pageContent += $('#' + targetId).html();
});
// 팝업
let newWindow = window.open('', '', 'width=1024, height=600'),
document = newWindow.document.open(),
pageContent =
'<!DOCTYPE html>\n' +
'<html>\n' +
'<head>\n' +
'<meta charset="utf-8" />\n' +
'<link rel="stylesheet" type="text/css" href="./css/print.css">' +
'<title> ' + title +' </title>\n' +
'</head>\n' +
'<body> '+
'<div class="pageTitle"> <h2> ' + title + '</h2> </div>'+
'\n\n' + pageContent + '\n</body>\n</html>';
document.write(pageContent);
document.close();
// 팝업 열기(CSS 로딩을 위해 Timer)
setTimeout(() => { newWindow.print(); }, 1000);
}
'DEV > SCRIPT' 카테고리의 다른 글
| JS : 호이스팅(Hoisting) (0) | 2025.06.09 |
|---|---|
| [JS] COPY (0) | 2024.02.22 |
| [JS] 배열 - 두 배열 합치기, 배열 평탄화, 배열 분할 (3) | 2023.12.08 |
| [JS] 소수점 (0) | 2023.12.08 |
| [JS] IS NULL, IS UNDEFINED (4) | 2023.12.08 |
- Total
- Today
- Yesterday
- BAT
- MySQL
- handdrip
- 로스터리
- Filter
- JSP
- GitHub
- LILI COFFEE
- Powershell
- MariaDB
- db
- SEQUENCE
- table
- 스페셜티
- date
- 단위변환
- Coffee
- JavaScript
- backup
- SQL
- Between
- Eclipse
- 커피
- partition
- 리리 커피
- diff
- dbeaver
- popup
- oracle
- VBS
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
