2010-06-29 2 views
0

overflow:auto 링크를 클릭하여 div를 인쇄하고 싶습니다. 아래는 내가 작업하고있는 코드는하지만jQuery, 링크 클릭시 콘텐츠 인쇄 옵션

printMe=window.open(); 
printMe.document.write($('.terms_and_conditions').html()); 
printMe.print(); 
printMe.close(); 

답변

1

당신이 좋아하는 click 이벤트에 포장 할 수 ... 페이지로드를 투여 량 : CSS 인쇄, 예 등을 사용하는 것이

$(function(){ 
    $('#element_id').click(function(){ 
    printMe=window.open(); 
    printMe.document.write($('.terms_and_conditions').html()); 
    printMe.print(); 
    printMe.close(); 
    }); 
}); 
+0

감사합니다! – CarterMan

+0

새 창을 열지 않고'.terms_and_conditions' 만 출력하도록 단순화하는 방법이 있습니까? – CarterMan

0

시도 이 :

@media print { 

    table, #MenuDiv, { 
     visibility: hidden; 
    } 

    .fd_window, infoHide, #selectedItems, .fd_body { 
     border: 0px solid; 
     width: 100%; 
    } 

    #selectedItems table { 
     visibility: visible!important; 
     color: #000; 
     display: block !important; 
     position: absolute; 
     left: 0; 
     top: 0; 
     height: 100%; 
     width: 8.5in; 
    } 

    #selectedItems table th, #form_selectedItems table td { 
     border: 1px solid #000; 
     padding: 3px; 
     vertical-align: top; 
    } 
}