仅打印输入的值

时间:2016-10-09 13:56:33

标签: html css

我只想询问如何以pdf样式打印并仅显示输入的值而不是文本框或下拉列表。

click this link to view the image

我也想展示这样的东西,但是怎么样?我希望有人能帮助我,提前谢谢你。 :)

click this link to view the image

最后,这是我的代码。

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        function printWebpage(t) {
            t.style.display = "none";
            window.print();
            t.style.display = "block";
        }
    </script>
</head>
<body>
    <h1>ALQUIZA SURVEYING OFFICE</h1>
    <h3>CONTRACTUAL PAYROLL</h3>
    Name: <input type="text" id="name" name="name"/>
    <br/><br/>
    Survey: <input type="text" id="survey" name="survey"/>
    <br/><br/>
    Payment:
    <select id="payment" name="payment">
        <option>Choose</option>
        <option>Single</option>
        <option>Double</option>
    </select>
    <br/><br/>
    Team:
    <select id="team" name="team">
        <option>Choose</option>
        <option>Team A</option>
        <option>Team B</option>
    </select>
    <br/><br/>
    <button onclick="printWebpage(this)">Print Webpage</button>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

使用CSS media queries

/* Only applied in print mode */
@media print {
    /* Hide or style your elements here */
    input[type=text] {
        border: none;
    }
    /* ... */
}

Here is a tutorial,其中解释了您的用例。