Dynamic webpage...

wxdqz

New Member
Hi there,

I'm currently building a dynamic webpage mainly using javascript's document.write.

I have an .htm document which contains a dropdown list containing elements I may want to insert in the page (eg image, textarea...). So basically, what I do is read the selected index in the dropdown list and then when the OK button is clicked, I use the document.write function to rewrite the page including the code for whichever element was chosen. This works just fine once. However, when I do the same thing again from the resulting document, the document.write function does not overwrite the source of the document, hence I get 2 header zones instead of one and everything is repeated.

For example : first use -> a textarea is chosen and inserted on click on the Ok button.
A new page is generated containing the same header as before, the same dropdown list and the same OK button. In addition to all this, the textarea field is added. This is perfect.

Second use -> I'm now using the generated document. I choose an image in the dropdown list. I click on the OK button and the image is appended to the resulting document BUT the textarea is still there (it shouldn't be) and furthermore there are 2 <html> tags and </html> tags now as well as 2 header zones...

Does anyone have any idea what I can do ?
 
Back
Top