title: How can I pass a value from one HTML page to another using JavaScript?
body: <p>This is my first HTML page:</p>
  
  <pre><code>&lt;!--first.html--&gt;   
  &lt;html&gt;
      &lt;body&gt;
      &lt;div data-role="page" data-theme="a" data-url="first" id="first"&gt; 
          &lt;form id="form1" name="form2" action="checking.html"&gt;
          &lt;input type="text" name="txtFileName" id="txtFileName"/&gt;
         &lt;!-- &lt;button onClick="uploadFile();"&gt;Upload&lt;/button&gt; --&gt;
         &lt;input type="hidden" name="hidden1" value=""&gt;
         &lt;br&gt;&lt;input type="submit"  value="Send me your name!"  onClick="submitform();"&gt;&lt;br&gt;
         &lt;/form&gt;
         &lt;script type="text/javascript"&gt;
         function submitform()
         {
           document.forms.form1.hidden1.value=1;
           alert("i am working");
  
          document.form1.submit();
         }
      &lt;/script&gt;
  
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my second HTML page:</p>
  
  <pre><code>&lt;!-- second.html --&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt; 
  &lt;h1&gt;Javascript call after page loaded&lt;/h1&gt;
  
  &lt;script&gt;
  function getQueryVariable2(variable) { 
    var query = window.location.search.substring(1); 
    document.write(query);
    var vars = query.split("&amp;"); 
    document.write("&lt;br /&gt;");
    document.write(vars);
  
    for (var i=0;i&lt;vars.length;i++) { 
      var pair = vars[i].split("="); 
      if (pair[0] == variable) { 
        return pair[1]; 
      }
    } 
  } 
  
  
  document.write("&lt;br /&gt;txtFileName = " + getQueryVariable2("txtFileName"));
  document.write("&lt;br /&gt;hid1 = " + getQueryVariable2("hid1"));
  &lt;/script&gt;
  hellllo
  &lt;/body&gt;
  </code></pre>
  
  <p>Here I want to display the contents of hidden1 from first.html. Please suggest to me what code I should use for this.</p>