-1

I divided the content of my HTML page between 2 separate subpages, as per the threads below:

Multiple distinct pages in one HTML file https://www.codegrepper.com/code-examples/html/multiple+pages+in+one+html+file

so, my code looks as this:

...
 <script>
  function show(shown, hidden) {
  document.getElementById(shown).style.display='block';
  document.getElementById(hidden).style.display='none';
  return false;
  }
 </script>
  ...
 </head>
  <body>
 <div id="header"></div>

  <main>
     <section class="container">
        <div class="top">
            <h1>Survey form</h1>
        </div>
        <article class="internal">
            <div>
                <h5 class="notification">Hi (...)</h5>
                <p><span class="asterisk">&#42;</span> Required</p>
                <div id="Page1">    <!--SURVEY FORM PAGE 1-->
                <h2 class="property">Property information</h2>
                    <form id="form1" action="" onsubmit="mySubmit()" onreset="myReset()">
                    ...COntent...
                    <a href="#" class="navbtn1" onclick="return show('Page2','Page1');">Next</a>
                   </form>
                </div>
                <div id="Page2" style="display:none">  <!--SURVEY FORM PAGE 2-->

                <h2 class="property">Layout</h2>
                <form id="form2" action="" onsubmit="mySubmit()" onreset="myReset()">
                ...content...
                <a href="#" class="navbtn2" onclick="return show('Page1','Page2');">Previous</a> 
                <br>
                </form>
                </div>

enter image description here

Is there a chance to keep 2nd page after refresh?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Geographos
  • 827
  • 2
  • 23
  • 57

1 Answers1

0

Refreshing the page will completely re-load the page in its initial state which I'm assuming was only showing the 'first page'. This is expected behavior.

James
  • 166
  • 8
  • Is there something what I can do in order to refresh the second page only? – Geographos Apr 30 '21 at 13:16
  • make them two separate html pages that link from one page to the other.Here's an example plunk - https://plnkr.co/edit/W0nzDb1xYmctzijl?preview – James Apr 30 '21 at 13:28