1

現在、表示されているリスト項目をどのように表示するかを正確に示すフォームのプレビューがありますが、問題は、印刷ボタンを FOrm Display に CEWP として追加したときに、Control P を使用した場合とまったく同じ機能を実行して印刷することです。ページ全体。コードを参照してください。

          <div style="text-align: center"><input onclick="window.print();return false;" type="button" value=" Print this page "/>&#160;</div>"

これに追加して、フォームのみを印刷し、ウィンドウの現在のビューの外側に他のコンテンツを印刷せず、実際に 8.5 x 11 を埋めたいと思います。

何か案は?

4

2 に答える 2

0

シンプルな印刷機能:

<input id="printpagebutton" type="button" value="Print this page" onclick="printpage()"/>

<script type="text/javascript">
function printpage() {
    //Get the print button and put it into a variable
    var printButton = document.getElementById("printpagebutton");
    //Set the print button visibility to 'hidden' 
    printButton.style.visibility = 'hidden';
    //Print the page content
    window.print()
    //Set the print button to 'visible' again 
    //[Delete this line if you want it to stay hidden after printing]
    printButton.style.visibility = 'visible';
  }
 </script>
于 2016-03-30T11:55:35.863 に答える