document.write and forms

J

John

A straight forward problem I think but my knowledge of JavaScript lets
me down.

I am taking in a lot of input using a form. After preparing an email
(FormMail.pl) I then use 'document.write' to create a new page with
all the users details nicely formatted. This includes checking radio
buttons, checkboxes etc.

Problem is as soon as I use the first 'document.write', the form and
all its contents are undefined. I have moved some of them to variables
for the time being but this is cumbersome.

Any solutions to what must be a simple issue greatly appreciated.

John
 
M

ManoDestra

You are going to have to sort out what your display is well before you do
your document.write(). document.write explicitly calls document.open() if
you haven't done it yourself. Use something like this.

var strText = new String();

strText += "some text 1";
strText += "some text 2";
strText += "etc, etc...";

with (document) {
open();
write(strText);
close();
}

Peter.
 
J

John

You are going to have to sort out what your display is well before you do
your document.write(). document.write explicitly calls document.open() if
you haven't done it yourself. Use something like this.

var strText = new String();

strText += "some text 1";
strText += "some text 2";
strText += "etc, etc...";

with (document) {
open();
write(strText);
close();
}

Peter.

Thanks Peter

Tried this and got -

some text 1some text 2etc, etc...

as expected (I think) on a fresh page. My document.write then followed
on another fresh page. form still undefined though.

I am not clear what this is telling me.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top