簡體   English   中英

HTML-保留用戶填寫的字段,並在“提交”時顯示在下一頁上

[英]HTML - Keep user filled fields and display on next page when “submitted”

我有一個真正的基本html訂單,要求提供姓名,地址,信用卡信息,賬單/運輸信息。 這是我的html示例。

 <fieldset> <legend>Personal information:</legend> <form> <label> First Name <input type="text"><br> </label> <label> Last Name: <input type="text"><br><br/> </label> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <b>Billing Address</b> Street Address: <input type="text" id="address_1"> (City, State, Zip): <input type="text" id="address_2"> <br/> <input type="checkbox" id="toshipping_checkbox"> <em>Check this box if Shipping Address and Billing Address are the same.</em> <br/> <b>Shipping Address</b> Street Address: <input type="text" id="shipping_address_1"> (City, State, Zip): <input type="text" id="shipping_address_2"> 

提交此表格后,我希望results.html打印出以前填寫的字段。

像這樣:

You've entered the following data:
firstname="whatever first name entered"
lastname=
address=

基本上接受所有輸入id並將它們打印為字符串。

創建打印腳本

 <script type="text/javascript">


        function PrintDiv() {
            $('document').ready(function () {


                var divContents = document.getElementById("WOcontainer").innerHTML;
                var printWindow = window.open('', '', 'height=800,width=1024');
                printWindow.document.write('<html><head><title>Personal Information</title>');
                printWindow.document.write('</head><body style=" font-family: Arial; font-size: 10px;" >');
                printWindow.document.write(divContents); 
                printWindow.document.write('</body> </html>');
                printWindow.document.close();
                printWindow.print();
            })
        }


    </script>

事件處理程序

<input id="Button1" type="button" value="button" onclick="PrintDiv();" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM