Scenario : I have two html files , when I put an orderID in one home.html other customerView.html gets updated. The other opens in a new window
Requirement where I need help: I want that there should be a kind of text file call it order.txt which keeps tab of all the entries I made in the home.hmtl upto 10 entries and show all those in the customerView.html and as I keep adding new orders to home.html order.txt should get updated removing the old entries in the text file on the basis FIFO. The second html file customerView.html should show all the entries in the file order.txt and get updated on any entry is made in home.html
I am not able to achieve the file handling but have written below to html files which help show orderID in customerView.html whenever I make an entry in home.html
<!DOCTYPE html>
<html>
</script>
<body bgcolor="yellow">
<h2 align="center">Welcome to OHH LA LA</h2>
<form target="page2.html" type=get action="customerView.html">
<table>
<tr>
<td>OrderID:</td>
<td colspan=200><input type=text name=orderId size=10></td>
</tr>
<tr>
<td colspan=200><input type=submit value="Submit">
</td>
</tr>
</table>
</form>
<body>
</html>
...
<!DOCTYPE html>
<html>
<body bgcolor="yellow">
<h2 align="center">Welcome to OHH LA LA</h2>
<script LANGUAGE="JavaScript">
function getParams(){
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++){
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
var params={};
params = getParams();
var firstname = unescape(params["orderId"]);
</script>
<h3 align="center"> Order Number Completed: <script>document.writeln (firstname);</script></h3>
</body>
</html>