document.write and forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    document.write and forms

    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
  • ManoDestra

    #2
    Re: document.write and forms

    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.

    "John" <j@laycus.con > wrote in message
    news:2ndnhv8spk 49c7d2abbki1fjm 1o8fbcjd2@4ax.c om...[color=blue]
    > 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[/color]


    Comment

    • John

      #3
      Re: document.write and forms

      On Tue, 22 Jul 2003 01:45:02 +0100, "ManoDestra "
      <manodestra.sof tware@ntlworld. com> wrote:
      [color=blue]
      >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.[/color]

      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

      Comment

      Working...