thepeskykid
04-22-2003, 10:42 PM
Hello :)
I have a frameset that displays two webpages... A (left) and B (right)
A displays a static form
B displays a webpage created out of JS generated HTML - This JS is written into A's head
B needs 3 parts to be displayed from top to bottom as follows
B1. Table with column titles
B2. Table with column data
B3. Table with footnotes
B2 receives its data by the user filling in the form fields and clicking submit - this data is added to a pre-existing array (mainArray) as a new array - this way, mainArray stores the complete set of data required for writing the lines of data in B2 - each array within mainArray represented by one tabular line within B2
I am using document.writeln on a line by line basis to generate the html required to display B1,B2 and B3 as required - B2 is created using a for loop that iterates through mainArray and passes the entries in each sub-array into the correct place in the document.writeln part
This all works :) ...... except for the fact that each rewrite of B adds the new version to the end of the existing version, so...
First User Input results in
B1
B2 - 1 line of data
B3
2nd User Input results in
B1
B2 - data line 1
B3
B1
B2 - data line 1
.......data line 2
B3
but the 2nd User Input should result in
B1
B2 - data line 1
.......data line 2
B3
I know the problem has nothing to do with the for/loop section - I think I need to make the target webpage (B) blank - to somehow erase the JS generated html and then recreate the required html from scratch
Basically... I am not sure how to solve this problem myself - all the references to document.write and document writeln refer to simple write examples whereas this is a little more involved
I would rather someone points me in the right direction instead of supplying a coded solution as I am very new to JS and I enjoy coding solutions myself... it's just that I really need some helpful nudges in the right direction on this one
Thank you
I have a frameset that displays two webpages... A (left) and B (right)
A displays a static form
B displays a webpage created out of JS generated HTML - This JS is written into A's head
B needs 3 parts to be displayed from top to bottom as follows
B1. Table with column titles
B2. Table with column data
B3. Table with footnotes
B2 receives its data by the user filling in the form fields and clicking submit - this data is added to a pre-existing array (mainArray) as a new array - this way, mainArray stores the complete set of data required for writing the lines of data in B2 - each array within mainArray represented by one tabular line within B2
I am using document.writeln on a line by line basis to generate the html required to display B1,B2 and B3 as required - B2 is created using a for loop that iterates through mainArray and passes the entries in each sub-array into the correct place in the document.writeln part
This all works :) ...... except for the fact that each rewrite of B adds the new version to the end of the existing version, so...
First User Input results in
B1
B2 - 1 line of data
B3
2nd User Input results in
B1
B2 - data line 1
B3
B1
B2 - data line 1
.......data line 2
B3
but the 2nd User Input should result in
B1
B2 - data line 1
.......data line 2
B3
I know the problem has nothing to do with the for/loop section - I think I need to make the target webpage (B) blank - to somehow erase the JS generated html and then recreate the required html from scratch
Basically... I am not sure how to solve this problem myself - all the references to document.write and document writeln refer to simple write examples whereas this is a little more involved
I would rather someone points me in the right direction instead of supplying a coded solution as I am very new to JS and I enjoy coding solutions myself... it's just that I really need some helpful nudges in the right direction on this one
Thank you