LoginSignup
kansai5963
@kansai5963

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

一部スクロール表示が含まれる画面を印刷する方法

解決したいこと

ホームページ画面の一部に縦スクロールの設定をしております。
画面上に印刷ボタンを作成し、プリントアウトしたいと考えておりますが、ファイル→印刷と押すと表示された部分のみしか印刷されません。
どなたかご存じでしたらご教示願います。

発生している問題・エラー

当該画面分しか印刷できない。
※スクロール部分も出力したい。最大で20行程度表示される場合がある。

該当するソースコード

<div style="top : 161px;left : 8px; position : absolute; z-index : 4; width : 847px; height : 252px; " id="Layer5">
  <div style="background: white; padding: 10px; margin-bottom: 10px; border: 1px solid #333333;" class="test">
    <table border="1" height="252" width="818">
      <tr bgcolor="gray" style="color:white"  height="50">
        <th height="42" size=10><b>注文日</b></th>
        <th height="42" width="212">品物・オプション<br>注文先・単価</th>
        <th height="42" size=10>金額/個数</th>
        <th height="42" size=20><b>発注者/入力者</b></th>
      </tr>

      <% for(var i in content) { %>
      <tr bgcolor="lightyellow" >
        <% var obj = content[i]; %>
          <td align="center" height="47" size="10">
            <input type="text" name=注文日  size="10" style="background:white; color:#000000;" align="middle" value="注文日" disabled="disabled">
          </td>
          <td align="center" height="47" width="10" style="white-space:nowrap;" >
            <input type="text" name=品物 size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.品物 %>" disabled="disabled">
            <input type="text" name=option size=1 style="background:white; color:#000000;" align="middle" value="" disabled="disabled">
            <input type="text" name=品物2 size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.品物2 %>" disabled="disabled">
            <input type="text" name=option2 size=1 style="background:white; color:#000000;" align="middle" value="" disabled="disabled">
            <input type="text" name=品物3 size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.品物3 %>" disabled="disabled">
            <input type="text" name=option3 size=1 style="background:white; color:#000000;" align="middle" value="" disabled="disabled"><br>
            <input type="text" name=tyumonsaki size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.order_destination %>" disabled="disabled">
            <input type="text" name=単価 size=1 style="background:white; color:#000000; text-align: right;" align="middle" value="<%= obj.単価 %>" disabled="disabled">
            <input type="text" name=tyumonsaki2 size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.order_destination2 %>" disabled="disabled">
            <input type="text" name=単価2 size=1 style="background:white; color:#000000; text-align: right;" align="middle" value="<%= obj.単価2 %>" disabled="disabled">
            <input type="text" name=tyumonsaki3 size=4 style="background:white; color:#000000;" align="middle" value="<%= obj.order_destination3 %>" disabled="disabled">
            <input type="text" name=単価3 size=1 style="background:white; color:#000000; text-align: right;" align="middle" value="<%= obj.単価3 %>" disabled="disabled">
        </td>
        <td align="center" height="47" size=10>
          <input type="text" name=合計金額 size=10 style="background:white; color:#000000; text-align: right;" align="middle" value="<%= obj.合計金額 %>" disabled="disabled">
          <input type="text" name=合計数 size=10 style="background:white; color:#000000; text-align: right;" align="middle" value="<%= obj.合計数 %>" disabled="disabled">
        </td>
        <td align="center" height="47" size=20>
          <input type="text" disabled="disabled" name=発注者 size=20 style="background:white; color:#000000;" align="middle" value="<%= obj.発注者 %>">
          <input type="text" disabled="disabled" name=入力者 size=20 style="background:white; color:#000000;" align="middle" value="<%= obj.入力者 %>">
        </td>
      </tr>
      <% } %>
    </table>
  </div>
</div>
.test {

  height: 250px;

  overflow-y: scroll;

}

自分で試したこと

onclick="window.print();

0

1Answer

Your answer might help someone💌