2012-03-11 2 views
3

인쇄 테이블 내가 자바 스크립트를 사용하여 테이블을 인쇄하려고

테이블 HTML은 다음과 같이이다 :

<table id="rounded" runat=server summary="2007 Major IT Companies' Profit" style="position:relative;left:-45px;" > 

     <tr> 
      <th scope="col" class="rounded-company">header1</th> 
     <th scope="col" class="rounded-q1">header2</th> 

      <th scope="col" class="rounded-q1">header3</th> 
      <th scope="col" class="rounded-q1">header4</th> 
       <th scope="col" class="rounded-q1">header5</th> 
       <th scope="col" class="rounded-q1">header6</th> 
       <th scope="col" class="rounded-q1">header7</th> 
       <th scope="col" class="rounded-q1">header8</th> 

        <th scope="col" class="rounded-q1">header9</th> 
        <th scope="col" class="rounded-q4"> header10</th> 


     </tr> 


</table> 

나는 테이블의 데이터 던져 아약스을 가지고 결국 그래서 이 같은 테이블의 모양을

<table id="rounded" runat=server summary="2007 Major IT Companies' Profit" style="position:relative;left:-45px;" > 

      <tr> 
       <th scope="col" class="rounded-company">header1</th> 
      <th scope="col" class="rounded-q1">header2</th> 

       <th scope="col" class="rounded-q1">header3</th> 
       <th scope="col" class="rounded-q1">header4</th> 
        <th scope="col" class="rounded-q1">header5</th> 
        <th scope="col" class="rounded-q1">header6</th> 
        <th scope="col" class="rounded-q1">header7</th> 
        <th scope="col" class="rounded-q1">header8</th> 

         <th scope="col" class="rounded-q1">header9</th> 
         <th scope="col" class="rounded-q4"> header10</th> 


      </tr> 
<tr> 
       <td>value1</td> 
       <td>value2</td> 

       <td>value3</td> 
       <td>value4</td> 
       <td></td> 
       <td>value6</td> 
       <td>value7</td> 
       <td>value8</td> 

       <td>value9</td> 
       <td>value10</td> 
      </tr> 
      <tr> 
       <td>value1</td> 
       <td>value2</td> 

       <td>value3</td> 
       <td>value4</td> 
       <td></td> 
       <td>value6</td> 
       <td>value7</td> 
       <td>value8</td> 

       <td>value9</td> 
       <td>value10</td> 
      </tr> 

</table> 

이 같은 테이블 인쇄 자바 스크립트를 사용하고 있습니다 :

,913,321을 0

문제 대신 innerHTML을의 innerText와 없기 때문에 테이블이 인쇄되어 있다는 것입니다 (행이 더 열이없는, 헤더)

내가 (페이지 소스에서)이 테이블을 가지고가는 경우에

과 (아약스없이)를 인쇄하려고 작동 잘 됐네.

무엇이 문제 일 수 있습니까?

도움 당신은 인쇄 문서를 작성하고있는 HTML에서 <table> 태그를 포함 할 필요가

답변

1

에 대해 잘 부탁 드리겠습니다. .html()을 호출하면 안에 테이블 태그가 나타납니다.

var content_vlue = $('#rounded').parent().html(); 
+0

빨랐다 :

는 또한 다른 요소에 다음의 (a <div> 또는 무언가)와 테이블을 포장 수 있습니다! 뾰족한 당신이 최고야. – baaroz

관련 문제