Rewrite Page

[Total: 0    Average: 0/5]

This script shows how to have a page completely re-written by javascript.

Head Code:

This script is designed to show how NS4 can be used to dynamically update content on the page.
function addRow(_v)
  var _html="<html><head>";
	  _html+="function addRow(_v){";
	  _html+="var _html='you figure this one out as this gets complicated fast!';";
	  _html+="return false;}";
	  _html+="<table width=400 height=300 border=1><tr><td height=300 width=400>";
	  _html+="<hr width=55% color=steelblue height=1 align=center>";
	  _html+="<form name=exf1 onsubmit='return addRow(this.t1.value)'>";
	  _html+="<input type=text name=t1 value='next default'>&nbsp;&nbsp;&nbsp;";
	  _html+="<input type=submit value='Add Another Row'>";
  return false; /* kill the submit */

Body Code:

<table width=400 height=300 border=1>
<tr><td height=300 width=400>&lt;&lt;EMPTY&gt;&gt;</td></tr>
<hr width=55% color=steelblue height=1 align=center>
<form name=exf1 onsubmit="return addRow(this.t1.value)">
<input type=text name=t1 value="default text">&nbsp;&nbsp;&nbsp;
<input type=submit value="Add Row">

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *