Home » Javascript » passing form data to another HTML page

passing form data to another HTML page

Posted by: admin August 19, 2018 Leave a comment


I have two HTML pages: form.html and display.html. In form.html, there is a form:

<form action="display.html">
    <input type="text" name="serialNumber" />
    <input type="submit" value="Submit" />

The form data is sent to display.html. I want to display and use the form data serialNumber in display.html, as shown below:

    <div id="write">
        <p>The serial number is: </p>
    function show() {
        document.getElementById("write").innerHTML = serialNumber;

So how can I pass the serialNumber variable from form.html to display.html so that the above code in display.html will show the serial number and the JavaScript function show() gets the serialNumber from the first HTML?