Francis Gabriel Rodriguez Francis Gabriel Rodriguez - 1 year ago 85
HTML Question

Document.write on a different html page

Hmm is it possible to

on other html page?

For example I create a two html page, the first page have a textfield and submit button. I enter a text in a textfield and after I click the submit button the value of the textfield will be transfer to the second html page and load the html page and write the value on it.

Just a beginner to javascript so bear with me please :D

Answer Source

Since you're using pure javascript and HTML, I assume server-side things are out of the picture. So Felix Kling's comment is actually, I think, a good way to go. Here's one way you could use localStorage to make this work:

/* index.html */
<form action="result.html" onsubmit="submit()">
  <input type="text" id="input">
  <input type="submit" value="Submit">
function submit() {
  var input = document.getElementById("input").value;
  localStorage.input = input;

/* result.html */
<div id="result"></div>
  document.getElementById("result").innerHTML = localStorage.input;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download