Loading ...
Sorry, an error occurred while loading the content.

Re: Assign variable to new window

Expand Messages
  • Jon Stephens
    Add this to the end of the showSalary() function: with(salaryWindow.document) { open(); write( ); write( + InputValue + );
    Message 1 of 2 , Mar 8 3:04 AM
    • 0 Attachment
      Add this to the end of the showSalary() function:

      with(salaryWindow.document)
      {
      open();

      write("<html><head></head><body>");
      write("<p>" + InputValue + "<p>");
      write("</body></html>");

      close();
      }

      > Date: Sun, 06 Mar 2005 22:42:59 -0000
      > From: "rdl410" <del410@...>
      > Subject: Assign variable to new window
      >
      >
      >
      > Hello All, I'm new to this group...and I would really appreciate it if
      > I could get help from all those JavaScript experts out there.
      >
      > I need to create a form with a text box, with a command button (submit
      > button) that opens a new window and displays the value entered in the
      > text box.
      >
      > So far, I've added a form that calls a function to open the new window
      > that I've created called newWindow.html. All I need to figure out is
      > how to use the document.write method to write the value in the new
      > window. So far, this is what I have:
      >
      > <script type="text/javascript">
      > function showSalary(linkTarget) {
      > salaryWindow = window.open(linkTarget, "salaryInfo", "toolbar=no,
      > menubar=no, location=no, scrollbar=yes, resizable=no, width=400,
      > height=325");
      > InputValue = document.salaryForm.salary.value;
      > salaryWindow.focus();
      > }
      > </script>
      >
      > <form name="salaryForm" action="">
      > Weekly Salary:
      > <input type="text" name="salary" value="" />
      > <input name="formButton" type="button" value="click"
      > onclick="showSalary('newWindow.html');" />
      > </form>
    Your message has been successfully submitted and would be delivered to recipients shortly.