How to write content one HTML page to another HTML page using JavaScript

Posted by Rajni.Shekhar under JavaScript category on | Points: 40 | Views : 2729
Lets say you have two pages a.html and b.html and you want to write in a.html page that will be shown in b.html page.


<form type=get action="b.html">
<td>Type Text Here:</td>
<td><input type=text name=yourtext size=10></td>
<input type="Submit" name=submit>


<script LANGUAGE="JavaScript">
function getParameters(){
var index = document.URL.indexOf('?');
var params = new Array();
if (index != -1) {
var pairs = document.URL.substring(index+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++){
paramName = pairs[i].split('=');
params[paramName[0]] = paramName[1];
return params;
params = getParameters();
yourtext = unescape(params["yourtext"]);
document.write("Your Text = " + yourtext + "<br>");

Comments or Responses

Login to post response